> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flowx.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Sending a notification

> The plugin can be used for sending many kinds of notifications such as emails or SMS notifications. It can be easily integrated in one of your business processes.

## Configuring the process

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

* use **FlowX Designer**  to create/edit a [notification template](./managing-notification-templates)
* use **Process Designer** to add a [**Send Message Task**](/4.0/docs/building-blocks/node/message-send-received-task-node) and a [**Receive Message Task**](../../../../building-blocks/node/message-send-received-task-node#receive-message-task)
* configure the needed node [actions](../../../../building-blocks/actions/actions)
* configure the request body

<Check>
  **DEVELOPER**: Make sure the needed [Kafka topics](../../../../../setup-guides/plugins-setup-guide/notifications-plugin-setup#kafka-configuration) 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
</Check>

The following values are expected in the request body:

|      Key     |                                          Definition                                         |           |
| :----------: | :-----------------------------------------------------------------------------------------: | :-------: |
|   language   |                               The language that should be used                              | Mandatory |
| templateName |                      The name of the notification template that is used                     | Mandatory |
|    channel   |                                Notification channel: SMS/MAIL                               | Mandatory |
|   receivers  |                          Notification receivers: email/phone number                         | Mandatory |
|  senderEmail |                                  Notification sender email                                  |  Optional |
|  senderName  |                                   Notification sender name                                  |  Optional |
|  attachments | Attachments that are sent with the notification template (only used for MAIL notifications) |  Optional |

<Check>
  Check the detailed [example](#example-send-a-notification-from-a-business-flow) below.
</Check>

![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/platform-deep-dive/notification_archi_send.png)

## Example: send a notification from a business flow

![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/platform-deep-dive/send_a_notification_proc.png)

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](./managing-notification-templates) for more information.

![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/platform-deep-dive/send_a_notif_from_business_flow.gif)

2. Use the FlowX.AI Designer to add a [**Send Message Task**](../../../../building-blocks/node/message-send-received-task-node#send-message-task) and a [**Receive Message Task**](../../../../building-blocks/node/message-send-received-task-node#receive-message-task).
3. 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`)

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

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

<Frame>
  ![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/platform-deep-dive/notif_params_send.png)
</Frame>

4. 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`).

<Frame>
  ![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/platform-deep-dive/generate_notif_receive.png)
</Frame>

5. 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.

![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/platform-deep-dive/notif_send_resp.png)

Response example at `KAFKA_TOPIC_NOTIFICATION_INTERNAL_OUT`:

```json theme={"dark"}
{
  "identifier": null,
  "templateName": "welcomeLetter",
  "language": "en",
  "error": null
}
```


## Related topics

- [Notifications plugin setup](/4.6.0/setup-guides/plugins-setup-guide/notifications-plugin-setup.md)
- [Notifications plugin](/4.6.0/docs/platform-deep-dive/plugins/custom-plugins/notifications-plugin/notifications-plugin-overview.md)
- [Timer boundary event](/4.6.0/docs/building-blocks/node/timer-events/timer-boundary-event.md)
- [Kafka send action](/4.6.0/docs/building-blocks/actions/kafka-send-action.md)
- [FlowX Engine setup](/4.6.0/setup-guides/flowx-engine-setup-guide/engine-setup.md)
