SENDO PUSH API


PUSH notification sending API to integrate your events into backend flows, client-side applications or scheduled automations.
Sends PUSH notifications to a client via token that identifies the target device for both iOS and Android platforms. Before receiving notifications, users of your mobile application must give permission to receive them on iPhone and Android devices. This is achieved by subscribing to them.
Delivery to iPhone devices requires configuration of Apple Push Notification (APN) and Google Cloud Messaging (GCM) services.

Send push by token

POSThttps://api.sendo.cloud/api/push/send-by-token

This endpoint is used to send a push notification to multiple mobile devices identified by their tokens.

Required attributes


FieldTypeDescriptionDefault ValueOptionalComments
notification_titlestringTitle of the notification.noneNo
notification_bodystringMessage of the notification.noneNo
url_imgstringThe URL of the image associated with the notification.noneYes
tokensarrayAn object containing the token of the device to which the notification will be sent.noneNo
content_availablearrayA boolean that is used in iOS to indicate whether the notification is available for use when the app is in the foreground.trueYes

Request body.


curl --location 'http://35.185.103.32:3000/api/push/sendByToken' 
--header 'Content-Type: application/json' 
--data  '{
"notification_title": "Token notification sending",
"notification_body": "Notification Description",
"url_img": "https://example.com/imagen.jpg",
"tokens": [{"token":"<MOBILE_TOKEN>","user_external_id":"2211"}]
}'
Response
CodeDescription
200Successful
{
  "messageId": [
    {
      "messageId": number,
      "token": string,
      "user_external_id": string
    }
  ],
  "success": boolean,
  "error": null
}

Server responses.

Send push by user

POSThttps://api.sendo.cloud/api/push/send-by-user

This endpoint is used to send a push notification to a user by user id.

Required attributes


FieldTypeDescriptionDefault ValueOptionalComments
notification_titlestringNotification titlenoneNo
notification_bodystringNotification bodynoneNo
url_imgstringThe URL of the image associated with the notification.none
user_external_idstringThe user ID of the user to send the notification to.noneNo
content_availablearrayA boolean that is used in iOS to indicate whether the notification is available for use when the app is in the foreground.trueYes

Request body.


curl --location 'http://35.185.103.32:3000/api/push/sendByToken' 
--header 'Content-Type: application/json' 
--data  '{
"notification_title": "Envio de notificación token",
"notification_body": "Descripción de la notificación",
"url_img": "https://ejemplo.com/imagen.jpg",
"user_external_id": "2211"
}'
Response
CódigoDescripción
200Successful
{
  "messageId": [
    {
      "messageId": number,
      "token": string,
      "user_external_id": string
    }
  ],
  "success": boolean,
  "error": null
}

Respuestas del servidor.

Send push by topic

POSThttps://api.sendo.cloud/api/push/send-by-topic

This endpoint is used to send a push notification to multiple mobile devices subscribed to a specific topic.

Required attributes


FieldTypeDescriptionDefault ValueOptionalComments
notification_titlestringTitle of the notification.noneNo
notification_bodystringDescription of the notification.noneNo
url_imgstringThe URL of the image associated with the notificationnoneYes
topicstringTopic to send notification with that topicnoneNo

Request body.


curl --location 'http://35.185.103.32:3000/api/push/sendBytopic' 
--header 'Content-Type: application/json' 
--data '{
"notification_title": "Sending topic notification",
"notification_body": "Test notification using topic",
"url_img": "https://ejemplo.com/imagen.jpg",
"topic": "Test Topic"
}'
Response
CodeDescription
200Successful
{
  "messageId": number,
  "success": boolean,
  "error": null
}

Server responses.

Subscribe

POSThttps://api.sendo.cloud/api/push/subscribe

This endpoint is used to subscribe mobile device tokens to a specific topic to receive push notifications.

Required attributes


FieldTypeDescriptionDefault ValueOptionalComments
tokensarrayAn array of mobile device tokensnoneNo
topicstringThe name of the topic to which the tokens will be subscribed.noneNo

Request body.


curl --location 'http://35.185.103.32:3000/api/push/subscribe' 
--header 'Content-Type: application/json' 
--data '{
"tokens": ["<MOBILE_TOKEN>"],
"topic": "Test topic"
}'
Response
CodeDescription
200Successful
{
  "success": true,
  "error": null
}

Server responses.

Unsubscribe

POSThttps://api.sendo.cloud/api/push/unsubscribe

This endpoint is used to unsubscribe mobile device tokens from a specific topic.

Required attributes


FieldTypeDescription
tokensarrayAn array of mobile device tokens that are subcribed to the topic.
topicstringThe name of the topic that the tokens would unsubscribe from.

Request body.


curl --location 'http://35.185.103.32:3000/api/push/unsubscribe' 
--header 'Content-Type: application/json' 
--data '{
"tokens": ["<MOBILE_TOKEN>"]
}'
Response
CodeDescription
200Successful
{
  "success": true,
  "error": null
}

Server responses.

History

POSThttps://api.sendo.cloud/api/push/history

This endpoint is used to get the push history of a specific user. The amount of history is limited to a 48 hours period.

Required attributes


FieldTypeDescription
userIdstringThe user ID of the user to get the push history for.

Request body.


curl --location 'https://api.sendo.cloud/api/push/history' 
--header 'Content-Type: application/json' 
--data '{
"userId": "<USER_ID>"
}'
Response
CodeDescription
200Successful
[
  {
    "messageId": "fed3fdfc-5fc6-456e-95b7-298a899dab87",
    "title": "Lorem ipsum dolor sit amet",
    "body": "Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae",
    "eventDate": "2024-06-18 11:23:36",
    "isRead": false
  },
  {
    "messageId": "fed3fdfc-5fc6-456e-95b7-298a899dab88",
    "title": "Lorem ipsum dolor sit amet",
    "body": "Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae",
    "eventDate": "2024-06-18 12:30:36",
    "isRead": true
  }
]

Server responses.

Delivery

POSThttps://api.sendo.cloud/api/push/delivery?messageId=<MESSAGE_ID>

This endpoint is used to update a push notification status event.

NOTE: For Firebase SDK: In development you should add the following code to enable the delivery metrics messaging().setDeliveryMetricsExportToBigQuery(true);

Required attributes


ParamTypeDescription
messageIdstringThe message ID of the push notification to update.

Response
CodeDescription
200Successful
{
  "status": "success"
}

Set as read

POSThttps://api.sendo.cloud/api/push/set-read

This endpoint is used to set a push notification as read.

Required attributes

FieldTypeDescription
messageIdArray of stringArray of message ID of the push notification to set as read.

Request body.


curl --location 'https://api.sendo.cloud/api/push/set-read' 
--header 'Content-Type: application/json' 
--data '{
"messageId": ["<MESSAGE_ID>"]
}'
Response
CodeDescription
200Successful
{
  "status": "success"
}

Server responses.

Enrollment

Set Token

POSThttps://api.sendo.cloud/api/push/set-token

This endpoint is capable to assign a user to the device token.

NOTE: API implementation must be done after the device token is generated by Firebase SDK.

Required attributes

FieldTypeDescriptionOptionalComments
user_external_idstringThe user ID of the user to enroll.No
tokenstringThe token of the device to enroll.No
osstringThe operating system of the device to enroll.Yes
modelstringThe model of the device to enroll.Yes

Request body.


curl --location 'https://api.sendo.cloud/api/push/enrollment' 
--header 'Content-Type: application/json' 
--data '{
"user_external_id": "<user_external_id>",
"token": "<TOKEN>"
}'
Response
CodeDescription
200Successful
{
  "status": "success",
  "message": "Token assigned to user 1"
}

Server responses.


Update token

PATCHhttps://api.sendo.cloud/api/push/update-token

This endpoint can be use to update user token.

Required attributes

FieldTypeDescriptionOptionalComments
user_external_idstringThe user ID of the user to update.No
oldTokenstringOld token of the device.No
newTokenstringThe new token generated by the device.No

Request body.


curl --location 'https://api.sendo.cloud/api/push/update-token' 
--header 'Content-Type: application/json' 
--data '{
"user_external_id": "<user_external_id>",
"oldToken": "<TOKEN>",
"newToken": "<TOKEN>"
}'
Response
CodeDescription
200Successful
{
  "status": "success",
  "message": "Token updated to user 1"
}

Server responses.