Skip to main content

Trigger Notifications

POST /api/v1/notifications/trigger

Description

This endpoint is used to trigger notifications for users in the system. It allows you to send notifications through various channels such as in-app, email, or SMS. You can also specify additional metadata like actions, images, links, and templates for the notification.

Headers:

  • tenantId (required): The unique identifier of the tenant initiating the notification. This header is necessary to identify the tenant context.

Example Request

{
"notifications": [
{
"type": "IN_APP",
"subject": "string",
"message": "string",
"userId": "string",
"tag": "string",
"image": "string",
"link": "string",
"actions": [
{
"action": "string",
"title": "string",
"url": "string"
}
],
"template": {
"payload": {
"key": "value",
"anotherKey": "anotherValue"
},
"templateName": "string"
}
}
]
}

Request Body Structure

The request body for triggering notifications includes the following fields:

  • notifications: A list of notifications to be triggered.

    • type: The type of the notification (e.g., IN_APP, EMAIL).
    • subject: The subject or title of the notification.
    • message: The body or content of the notification.
    • userId: The recipient's user ID.
    • tag: A tag associated with the notification, useful for categorization.
    • image: A URL to an image related to the notification.
    • link: A link that the user can follow when interacting with the notification.
    • actions: A list of actions that the user can take.
      • action: The type of action (e.g., OPEN, DISMISS).
      • title: The title of the action button.
      • url: The URL the action points to.
  • template: A template object that defines the payload and template name used for the notification.

    • payload: Key-value pairs that populate the template.
    • templateName: The name of the template to be used.