Skip to main content

Update Notification

Este endpoint permite actualizar una notificacion usando el uuid del mensaje previamente creado, este endpoint permite una amplia configuracion de los mensajes de igual forma que en la creacion.

Endpoint

Headers

KeyValueDescription
Content-Typeapplication/json
AuthorizationBearer LVwuk3_oug0D60ZTwm...access_token obtained in Atenea

Url

Method: POST
URL: https://api.trust.lat/message-persistance/api/v1/factory/:uuid
caution

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

Como obtener un access token

Path Variables

KeyValueDescription
uuid67ded174-a9ea...Identificador unico de notifiacion

Body

{
"notification_version": "trust_notifications_v1",
"notification_type": "dialog",
"data": {
"title": "titulo prueba",
"message": "body prueba",
"media_url": "https://.google.cl/photo.svg",
"action_color": "#348dfc"
},
"config": {
"priority": "normal",
"persistent": true,
"cancelable": true,
"play_time": 1,
"portrait": true,
"auto_play": true,
"is_sound": true
},
"buttons": {
"button_1": {
"action": "https://www.google.cl",
"color": "#348dfc",
"text": "Ir al sitio",
"type": "url"
},
"button_2": {
"action": "https://www.google.cl",
"color": "#348dfc",
"text": "Ir al sitio",
"type": "url"
}
},
"values": [],
"metadata": {
"reactions": [
"smile", "blush", "joy"
]
}
}

El campo notification_type indica el tipo de notificación que se desea crear pudiendo ser de notification, dialog, video o banner.

FieldTypeRequiredValuesExamplesComments
notification_versionStringtrue[trust_notifications_v1]trust_notifications_v1
notification_typeStringtrue[notification, dialog, video, banner]notification
valuesArraytrue[]Must be a empty array

Data

Este campo configura el contenido principal del mensaje, tener cuidado con las imagenes/videos y los colores. Imagenes: Deben ser https y accesible desde cualquier red, formatos permitidos .png y .jpg. Videos: Deben ser https y accesible desde cualquier red, formatos permitidos .mp4 y deben tener un peso ligero para evitar problemas de lentitud al mostrar el video. Color: Precaución con el formato, enviar un color en formato incorrecto causa problemas al mostrar la notificacion, formatos soportado RGB hexadecimal sin transparencia.

FieldTypeRequiredDefaultCommentsExamples
titleStringtrueTitle of message
messageStringtrueBody of message
media_urlString, UrltrueMust be video o image url with httpshttps://trust-assets.s3.amazonaws.com/enrollment/dialogo_covid.png
action_colorString, ColortrueColor of buttons#9E2626

Buttons

Define los botones que se mostrarán en los mensajes, por ahora solo se utilizaran button_1 y button_2 siendo este último opcional

FieldTypeRequiredDefaultValuesCommentsExamples
actionString, UrltrueOnly 'high' or 'normal'https://google.cl
colorString, ColorfalseRGB Hex color#9E2626
textStringtruePresione Aquí
typetypetrue[url, call, mail]url

Config

FieldTypeRequiredDefaultCommentsExamples
priorityStringfalsehighOnly 'high' or 'normal'high
persistentBooleanfalsefalsetrue
cancelableBooleanfalsefalsefalse
play_timeIntfalse05

Metadata

FieldTypeRequiredDefaultCommentsExamples
reactionsArray of stringsfalseNoneArray of strings than contains the "reaction_name" of emojis. Max 5, min 1reactions: [ "smile", "blush", "joy" ]
info

Revisar la lista de emojis permitidos para este endpoint

Emojis permitidos

Code Examples

curl --location --request POST 'api.trust.lat/api/v1/factory/67ded174-a9ea...' \
--header 'Content-Type: application/json' \
--data-raw '{
"notification_version": "trust_notifications_v1",
"notification_type": "dialog",
"data": {
"title": "titulo prueba",
"message": "body prueba",
"media_url": "https://.google.cl/photo.svg",
"action_color": "#348dfc"
},
"config": {
"priority": "normal",
"persistent": true,
"cancelable": true,
"play_time": 1,
"portrait": true,
"auto_play": true,
"is_sound": true
},
"buttons": {
"button_1": {
"action": "https://www.google.cl",
"color": "#348dfc",
"text": "Ir al sitio",
"type": "url"
},
"button_2": {
"action": "https://www.google.cl",
"color": "#348dfc",
"text": "Ir al sitio",
"type": "url"
}
},
"values": [],
"metadata": {
"reactions": [
"smile", "heart_eyes", "heart_eyes", "heart_eyes", "heart_eyes"
]
},
}'

Responses

HTTP Code: 201 Created

{
"code": 201,
"resource": "message",
"data": {
"id": 1,
"uuid": "05500f30-91c6...",
"custom_notification": {
"priority": "normal",
"data": {
"type": "dialog",
"reactions": "[{\"reaction_name\":\"rage\",\"emoji_hex\":\"U+1F621\"},{\"reaction_name\":\"cry\",\"emoji_hex\":\"U+1F622\"}]",
"notificationDialog": "{\"text_title\":\"titulo prueba\",\"text_body\":\"body prueba\",\"image_url\":\"https://.google.cl/photo.svg\",\"isPersistent\":true,\"isCancelable\":true,\"min_play_time\":\"1\",\"portrait\":true,\"autoPlay\":true,\"isSound\":true,\"buttons\":[{\"action\":\"https://www.google.cl\",\"color\":\"#348dfc\",\"text\":\"Ir al sitio\",\"type\":\"url\"},{\"action\":\"https://www.google.cl\",\"color\":\"#348dfc\",\"text\":\"Ir al sitio\",\"type\":\"url\"}]}"
},
"apns": {
"payload": {
"aps": {
"sound": "default",
"category": "url-url",
"mutable-content": 1,
"alert": {
"title": "titulo prueba",
"body": "body prueba"
},
"badge": 0
},
"data": {
"type": "dialog",
"reactions": "[{\"reaction_name\":\"rage\",\"emoji_hex\":\"U+1F621\"},{\"reaction_name\":\"cry\",\"emoji_hex\":\"U+1F622\"}]",
"notificationDialog": "{\"text_title\":\"titulo prueba\",\"text_body\":\"body prueba\",\"image_url\":\"https://.google.cl/photo.svg\",\"isPersistent\":true,\"isCancelable\":true,\"min_play_time\":\"1\",\"portrait\":true,\"autoPlay\":true,\"isSound\":true,\"buttons\":[{\"action\":\"https://www.google.cl\",\"color\":\"#348dfc\",\"text\":\"Ir al sitio\",\"type\":\"url\"},{\"action\":\"https://www.google.cl\",\"color\":\"#348dfc\",\"text\":\"Ir al sitio\",\"type\":\"url\"}]}"
}
}
}
},
"values": [],
"created_at": "2021-07-13T03:02:27.597Z",
"updated_at": "2021-07-13T03:02:27.597Z",
"status": true,
"type_notification": "trust_notifications_v1",
"disposable": false,
"version": 1,
"factory_message": {
"type": "dialog",
"data": {
"title": "titulo prueba",
"message": "body prueba",
"media_url": "https://.google.cl/photo.svg",
"action_color": "#348dfc"
},
"config": {
"priority": "normal",
"persistent": true,
"cancelable": true,
"play_time": 1,
"portrait": true,
"auto_play": true,
"is_sound": true
},
"buttons": {
"button_1": {
"action": "https://www.google.cl",
"color": "#348dfc",
"text": "Ir al sitio",
"type": "url"
},
"button_2": {
"action": "https://www.google.cl",
"color": "#348dfc",
"text": "Ir al sitio",
"type": "url"
}
},
"metadata": {
"reactions": [
"rage",
"cry"
]
}
},
"company_uuid": null
},
"message": "Created"
}