Skip to main content

Send Message

Endpoint que permite el envío de una notificación ingresando la aplicación y el trust_id de a quien se desea enviar.

Para indicar la aplicación objetivo puede ser mediante el nombre de la misma o uno de los bundle_id que tenga.

El formato de la notificación está dado por el formato de firebase, para más información acceder a los siguientes enlaces:

Endpoint#

Headers

KeyValueDescription
Content-Typeapplication/json
AuthorizationBearer {{access_token}}access_token obtained in Atenea

Url

Method: POST
URL: https://api.trust.lat/notifications/v2/device/sendmessage
caution

Recuerda que para utilizar este endpoint es necesario un access token obtenido en el servicio Atenea

Como obtener un access token

Body#

{
"application_name": "com.bundle_id.application",
"trust_id": "zase127e-a893-4034-8654-092v4c9c09ae",
"data":{
"type":"notification",
"codigo_documento":"C80001FAA2",
"origin":"Example Page",
"tag":"Trust",
"title":"Tienes un documento pendiente",
"body":"DEMO "
},
"priority": "high",
"apns": {
"payload": {
"aps": {
"sound": "default"
}
}
}
}

Code Examples#

curl --location --request POST 'https://api.trust.lat/notifications/v2/device/sendmessage' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{accessToken}}' \
--data-raw '{
"application_name": "com.bundle_id.application",
"trust_id": "zase127e-a893-4034-8654-092v4c9c09ae",
"data":{
"type":"notification",
"codigo_documento":"A180001FAA332",
"origin":"Example Page",
"tag":"Trust",
"title":"Tienes un documento pendiente",
"body":"DEMO "
},
"priority": "high",
"apns": {
"payload": {
"aps": {
"sound": "default"
}
}
}
}'

Responses#

HTTP Code: 200 OK#

{
"status": "success",
"code": 200,
"message": "The message is sended correctly",
"resource": "Device",
"total": 1,
"data": {
"name": "aplicacion-prueba",
"message_id": "0:162678656548177c8499bfzfd7ecd",
"source": "firebase",
"notification_uuid": "z7fb5dd4-9a3e-4d79-be33-0c33sd98a76"
}
}

HTTP Code: 404 Not Found#

{
"status": "error",
"code": 404,
"message": "Not Found",
"resource": "Device",
"total": 0,
"error": "Device not found"
}

HTTP Code: 404 Not Found#

{
"status": "error",
"code": 404,
"message": "Error sending the message, possibly caused by the device not updating its firebase token",
"resource": "",
"total": 0
}
Last updated on by Claudio-Franco