Skip to content

Publishing Notifications

Publishing a notification to an end user can be achived by calling this endpoint. this will generate the different configured templates and send them off to be processed.

Post /publish/{notificationType}/{customerId}

notificationType

this is the name of the notification you want to send. for example: there is a notification type called "Test" so you would put "Test" in this field

Post /publish/Test/{customerId}

customerId

this is the customer id in our system, sometimes reffered to as ESID or customer_id but generally its the customerId

Request Body

this can be any json object, an object that contains all the fields that are needed to be replaced within the template

Example

{
  "name": "John",
  "surname": "Doe",
  "products": [
    {
      "id": "1",
      "name": "Awesome Product"
    },
    {
      "id": "1",
      "name": "Awesome Product 2"
    }
  ]
}

this will return a notification request Id

1
2
3
{
  "notification_request_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}

with this Id you can call

Get /notification-requests/{id}

this will give you the current state of the notification, along with all the information that was used to generate the notifications

{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "notifications_type_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "customers": [
    "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  ],
  "context": {
    "additionalProp1": "string",
    "additionalProp2": "string",
    "additionalProp3": "string"
  },
  "created": "2024-11-27T12:50:27.268Z",
  "provider_requests": [
    {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "provider_type": "Sms",
      "notification": {
        "provider_type": "Sms",
        "body": "string",
        "template_errors": [
          "string"
        ]
      },
      "status": "Pending",
      "message": "string",
      "submitted": "2024-11-27T12:50:27.268Z",
      "updated": "2024-11-27T12:50:27.268Z"
    }
  ]
}

provider_requests

contains a list of notifications sent per provider, Sms, Email or PushNotification, with the transformed template with errors that occured during rendering if any.