[Eg-newdevs] Action trigger for Hemlock push notifications
Morgan, Michele
mmorgan at noblenet.org
Thu Jan 16 10:13:49 EST 2025
After Gina shared their experiences with setting up a Hemlock push
notifications action trigger at the meeting yesterday, I wondered again
about using the opt-in functionality built into the action triggers to
limit which patrons receive the notifications, rather than a custom filter.
We have several action triggers running successfully in production using
user settings to allow patrons to opt-in to certain notices, so I wasn't
sure what would be different with this one.
I took a little time to try setting one up on one of our test systems using
the user setting type in the '*Opt-in Setting Type*' field in the event
definition. Long story short, it worked for me! No custom filter was
necessary, and events were only created for the patron with the user
setting set.
To set up the definition, I cloned one of our existing overdue notification
triggers, saying *Yes to cloning the Environment.* Then I edited the
definition to use the Hemlock push notifications user setting.
These are the fields from the event definition that worked:
Owning Library: NOBLE *(Consortium)*
Name: Hemlock push notifications
Hook: checkout.due
Enabled: true
Processing Delay: 1 day
Processing Delay Context Field: due_date
Processing Group Context Field: usr
Reactor: *ProcessTemplate* *(for testing, so the event_output will be
generated, but nothing else will happen. For production, this would be
CallHTTP)*
Validator: CircIsOpen
Event Repeatability Delay: *00:01:00* *(for testing, allowing duplicate
events to be created after 1 minute for subsequent runs of the trigger)*
Granularity: *hemlock_push* *(for testing: to control when the trigger
runs, can be used for production as well)*
Max Event Validity Delay: 10 days
Opt-In Setting Type: *hemlock.push_notification_data*
Opt-In User Field: *usr*
Retention Interval: 6 mons
*Template:* *(from Ken's
documentation: https://github.com/kenstir/hemlock-docs/blob/main/docs/pn-setup-guide/configure-evergreen.md#sample-template
<https://github.com/kenstir/hemlock-docs/blob/main/docs/pn-setup-guide/configure-evergreen.md#sample-template>)*
Context Bib Path: target_copy.call_number.record
Context Item Path: target_copy
Context Library Path: circ_lib
Context User Path: usr
This command will run only this trigger based on its granularity:
/openils/bin/action_trigger_runner.pl --osrf-config
/openils/conf/opensrf_core.xml --process-hooks --run-pending --granularity
hemlock_push --granularity-only
Running this trigger will look at circulations due between one day and ten
days ago. On my test system, there are seven open circulations due in this
time period. I set the user setting hemlock.push_notification_data for one
user linked to two of those checkouts. Only two events were created, linked
to one row that was created in event_output.
I removed the user setting from the patron and ran the trigger again after
one minute. No events were created. Here is the log entry showing the
criteria for gathering the circs:
[2025-01-16 14:35:46] open-ils.trigger
[INFO:307910:CStoreEditor.pm:155:173703694530637333] editor[1|0] request
en-US open-ils.cstore.direct.action.circulation.id_list.atomic
[{"checkin_time":null,"-and":[{"+atev":{"id":null}},
*{"-exists":{"from":"aus","where":{"name":"hemlock.push_notification_data","value":"true","usr":{"=":{"+circ":"usr"}}}}}*],"due_date":{"between":["2025-01-06
14:35:46+0000","2025-01-15
14:35:46+0000"]},"circ_lib":{"in":{"where":{"id":1},"select":{"aou":[{"transform":"actor.org_unit_descendants","column":"id","result_field":"id"}]},"from":"aou"}},"-or":[{"stop_fines":["MAXFINES"]},{"stop_fines":null}]},{"join":{"atev":{"type":"left","fkey":"id","filter":{"event_def":585,"start_time":{">":"2025-01-16
14:34:46+0000"}},"field":"target"}}}]
So the opt-in setting should definitely work to limit events to patrons
with the setting, there should be no need for a custom filter.
I hope this is helpful! We're definitely interested in this feature also!
Michele
--
Michele M. Morgan, Systems Support Specialist
North of Boston Library Exchange, Danvers Massachusetts
mmorgan at noblenet.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.evergreen-ils.org/pipermail/eg-newdevs/attachments/20250116/c471e8ed/attachment-0001.htm>
More information about the Eg-newdevs
mailing list