mod-notify should be changed to support the sending and forming of messages using of all available delivery channels.
The module must provide a simple API for sending a message and creating sending events
When creating a notification, it will provide the ability to specify which event bound with message, the links to the data that are required for the template engine.
mod-notify must act as a facade for sending any notifications, use the template engine to generate a message, and delegate the sending of messages to the mod-sender
Delivery channel will be taken from userData or getting it from eventConfiguration
- POST the new notification to mod-notify
- mod-notify start prepareing data for sending message
- If notify have a eventConfigId and delivery channel is “email” or another except of “inApp”, then get eventConfig from mod-event-config.
- If notify request have context or contextLinks, then get template id from eventConfig.
- Call mod-template engine with template id and context for getting a prepared message.
- Load from userData sender’s and recipient's delivery data (email/phone/etc) and preferable delivery channel for recipient
- Form message and call to mod-sender for sending notifications using delivery channels.
"lang" : "en",
Text field should be used only we dont need to generate message from template using context.
It should be a possibility setup context as object or like a links to entities at the FOLIO system. If it links, mod-notify load data and generate context object for sending it to mod-template-engine.
EventConfig entity store a information about template, so if eventConfigId is not specified at request, mod-notify shouldn’t send message to mod-sender. Also, update of notification entity this action shouldn’t sending new message to mod-sender.
GIVEN mod-notify is changed for sending all types of messages
WHEN POST request with notify entity to mod-notify
THEN message will be generated from template and context
THEN message will be delivered to recipient using delivery channel setuped at the eventConfig
- unit test are created and passed