Skip to main content

Service Broadcast Notification

POST /api/v1/notifications/service-broadcast

Description

This endpoint broadcasts a notification to users using a service key. It allows in-app notifications to be delivered with various details such as type, subject, message, and actions.

URL Parameters:

  • No URL parameters required.

Headers:

  • service-api-key (required): The API key of the service broadcasting the notification.
  • service-api-code (required): The API code of the service broadcasting the notification.
  • tenantId (required): The tenant ID under which the notification is broadcast.

Sample Request Body

{
"time": "string",
"tag": "string",
"notification": {
"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:

The request body should include the following:

  • time: The time at which the notification is to be broadcasted.
  • tag: A tag to categorize the notification.
  • notification: The details of the notification, including:
    • type: The type of notification (e.g., IN_APP).
    • subject: The subject of the notification.
    • message: The message content of the notification.
    • userId: The ID of the user to whom the notification is directed.
    • tag: A tag related to the notification.
    • image: An optional image associated with the notification.
    • link: A URL related to the notification.
    • actions: An array of action objects related to the notification:
      • action: The action type.
      • title: The title of the action.
      • url: The URL for the action.
    • template: A template object to customize the notification:
      • payload: Key-value pairs for the template.
      • templateName: The name of the template used.

Example Request:

curl -X POST "{{baseURL}}/api/v1/notifications/service-broadcast" \
-H "service-api-key: APIKEY123" \
-H "service-api-code: APICODE456" \
-H "tenantId: TEN789" \
-d '{
"time": "2024-09-23T12:34:56Z",
"tag": "NEW_FEATURE",
"notification": {
"type": "IN_APP",
"subject": "New Feature Released",
"message": "Check out the latest feature in the app.",
"userId": "USR123",
"tag": "FEATURE_TAG",
"image": "https://example.com/image.png",
"link": "https://example.com/new-feature",
"actions": [
{
"action": "VIEW",
"title": "View Feature",
"url": "https://example.com/new-feature"
}
],
"template": {
"payload": {
"key": "value",
"anotherKey": "anotherValue"
},
"templateName": "FeatureTemplate"
}
}
}'