Community Forum

Ask a Question
Back to All

Unable to send a custom notification

I'm able to send out a custom notification when using the rest API from postman for example, but I'm not managing to send out the notification from the code. I've tried invoking the Root object directly:

await root.notifications.triggerCustomEvent({
customEventKey: 'policy_anniversary_custom_notification',
customEventType: 'policy',
id: policy.policy_id,
});

as well as now with an action from the alteration hook:
{
name: 'trigger_custom_notification_event',
custom_event_key: 'policy_anniversary_custom_notification',
custom_event_type: 'policy',
policy_id: policy.policy_id,
}

But none of the above methods are working.

Please advise. An example of a policy that should have sent a notification is https://app.root.co.za/orgs/d00e0ea4-0ee2-4c08-804d-61df85ca32ec/insurance/policies/d5f2f53e-10fb-4dd6-bb62-c9374e9c791f. I can see two alterations where 'applied' one being the update_policy_module_data and the other being the trigger_custom_notification_event.

Thanks in advance,