Configuring the process

To configure a business process that sends notifications you must follow the next steps:

DEVELOPER: Make sure the needed Kafka topics are configured properly.

Kafka topic names can be set by using the following environment variables:

  • KAFKA_TOPIC_NOTIFICATION_INTERNAL_IN - topic used to trigger the request to send a notification
  • KAFKA_TOPIC_NOTIFICATION_INTERNAL_OUT - topic used for sending replies after sending the notification

The following values are expected in the request body:

KeyDefinition
languageThe language that should be usedMandatory
templateNameThe name of the notification template that is usedMandatory
channelNotification channel: SMS/MAILMandatory
receiversNotification receivers: email/phone numberMandatory
senderEmailNotification sender emailOptional
senderNameNotification sender nameOptional
attachmentsAttachments that are sent with the notification template (only used for MAIL notifications)Optional

Check the detailed example below.

Example: send a notification from a business flow

Let’s pick a simple use-case, say we need to send a new welcome letter when we onboard a new customer. The steps are the following:

  1. Configure the template that you want to use for the welcome email, see the previous section, Managing notification templates for more information.

  1. Use the FlowX.AI Designer to add a Send Message Task and a Receive Message Task.
  2. On the Send Message Task add a proper configuration to the action, the Kafka topic and request body message to be sent:
  • Topics - KAFKA_TOPIC_NOTIFICATION_INTERNAL_IN - (in our example, flowx-notifications-qa)

You can check the defined topics by going to FlowX Designer > Platform Status > notification-plugin-mngt > kafkaTopicsHealthCheckIndicator > details > configuration > topic > notifications.

  • Message (expected parameters):
    • templateName
    • channel
    • language
    • receivers
  • Headers - it is always {"processInstanceId": ${processInstanceId}}

  1. On the Receive Message Task add the needed topic to receive the kafka response - KAFKA_TOPIC_NOTIFICATION_INTERNAL_OUT - (in our example, ai.flowx.updates.qa.notification.request.v1).

  1. Run the process and look for the response (you can view it via the Audit log) or checking the responses on the Kafka topic defined at KAFKA_TOPIC_NOTIFICATION_INTERNAL_OUT variable.

Response example at KAFKA_TOPIC_NOTIFICATION_INTERNAL_OUT:

{
  "identifier": null,
  "templateName": "welcomeLetter",
  "language": "en",
  "error": null
}