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
This endpoint is used to send a push notification to multiple mobile devices identified by their tokens.
Required attributes
| Field | Type | Description | Default Value | Optional | Comments |
|---|---|---|---|---|---|
| notification_title | string | Title of the notification. | none | No | |
| notification_body | string | Message of the notification. | none | No | |
| url_img | string | The URL of the image associated with the notification. | none | Yes | |
| tokens | array | An object containing the token of the device to which the notification will be sent. | none | No | |
| content_available | array | A boolean that is used in iOS to indicate whether the notification is available for use when the app is in the foreground. | true | Yes |
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"}]}'
| Code | Description |
|---|---|
| 200 | Successful |
{
"messageId": [
{
"messageId": number,
"token": string,
"user_external_id": string
}
],
"success": boolean,
"error": null
}
Server responses.
Send push by user
This endpoint is used to send a push notification to a user by user id.
Required attributes
| Field | Type | Description | Default Value | Optional | Comments |
|---|---|---|---|---|---|
| notification_title | string | Notification title | none | No | |
| notification_body | string | Notification body | none | No | |
| url_img | string | The URL of the image associated with the notification. | none | Sí | |
| user_external_id | string | The user ID of the user to send the notification to. | none | No | |
| content_available | array | A boolean that is used in iOS to indicate whether the notification is available for use when the app is in the foreground. | true | Yes |
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"}'
| Código | Descripción |
|---|---|
| 200 | Successful |
{
"messageId": [
{
"messageId": number,
"token": string,
"user_external_id": string
}
],
"success": boolean,
"error": null
}
Respuestas del servidor.
Send push by topic
This endpoint is used to send a push notification to multiple mobile devices subscribed to a specific topic.
Required attributes
| Field | Type | Description | Default Value | Optional | Comments |
|---|---|---|---|---|---|
| notification_title | string | Title of the notification. | none | No | |
| notification_body | string | Description of the notification. | none | No | |
| url_img | string | The URL of the image associated with the notification | none | Yes | |
| topic | string | Topic to send notification with that topic | none | No |
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"}'
| Code | Description |
|---|---|
| 200 | Successful |
{
"messageId": number,
"success": boolean,
"error": null
}
Server responses.
Subscribe
This endpoint is used to subscribe mobile device tokens to a specific topic to receive push notifications.
Required attributes
| Field | Type | Description | Default Value | Optional | Comments |
|---|---|---|---|---|---|
| tokens | array | An array of mobile device tokens | none | No | |
| topic | string | The name of the topic to which the tokens will be subscribed. | none | No |
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"}'
| Code | Description |
|---|---|
| 200 | Successful |
{
"success": true,
"error": null
}
Server responses.
Unsubscribe
This endpoint is used to unsubscribe mobile device tokens from a specific topic.
Required attributes
| Field | Type | Description |
|---|---|---|
| tokens | array | An array of mobile device tokens that are subcribed to the topic. |
| topic | string | The 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>"]}'
| Code | Description |
|---|---|
| 200 | Successful |
{
"success": true,
"error": null
}
Server responses.
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
| Field | Type | Description |
|---|---|---|
| userId | string | The 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>"}'
| Code | Description |
|---|---|
| 200 | Successful |
[
{
"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
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
| Param | Type | Description |
|---|---|---|
| messageId | string | The message ID of the push notification to update. |
| Code | Description |
|---|---|
| 200 | Successful |
{
"status": "success"
}
Set as read
This endpoint is used to set a push notification as read.
Required attributes
| Field | Type | Description |
|---|---|---|
| messageId | Array of string | Array 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>"]}'
| Code | Description |
|---|---|
| 200 | Successful |
{
"status": "success"
}
Server responses.
Enrollment
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
| Field | Type | Description | Optional | Comments |
|---|---|---|---|---|
| user_external_id | string | The user ID of the user to enroll. | No | |
| token | string | The token of the device to enroll. | No | |
| os | string | The operating system of the device to enroll. | Yes | |
| model | string | The 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>"}'
| Code | Description |
|---|---|
| 200 | Successful |
{
"status": "success",
"message": "Token assigned to user 1"
}
Server responses.
Update token
This endpoint can be use to update user token.
Required attributes
| Field | Type | Description | Optional | Comments |
|---|---|---|---|---|
| user_external_id | string | The user ID of the user to update. | No | |
| oldToken | string | Old token of the device. | No | |
| newToken | string | The 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>"}'
| Code | Description |
|---|---|
| 200 | Successful |
{
"status": "success",
"message": "Token updated to user 1"
}
Server responses.