Skip to main content

Append New Message

Este endpoint permite agregar un nuevo mensaje a un TrustFeed en específico. Se necesita como parámetro el trust_feed_uuid para especificar a qué TrustFeed agregar el mensaje. Se pueden agregar varios tipos de mensajes, los cuales son de tipo compact, video y full_image.Los campos que recibe son:

  • output_type
  • title
  • text
  • media
  • media_type
  • action_type
  • action_text
  • action_link

Como respuesta, el endpoint devuelve el mensaje creado.

Endpoint#

KeyValueDescription
Content-Typeapplication/json
AuthorizationBearer {{access_token}}access_token obtained in Atenea
Method: POST
URL: https://api.trust.lat/v1/trust_feed/:trust_feed_uuid/message

URL Variables:

KeyDescription
trust_feed_uuiduuid del TrustFeed al cual se quiera agregar el mensaje
caution

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

Como obtener un access token

Body#

Como se mencionó antes, existen muchos tipos de mensajes, a continuación se mostrará ejemplos del payload para cada uno:

{
"output_type": "trust_feed_compact",
"title": "hola",
"text": "esto es un mensaje",
"media": "https://picsum.photos/200/300",
"media_type": "img",
"action_type": "url",
"action_text": "ir al sitio",
"action_link": "www.google.cl"
}

Descripcíón de campos

KeyRequiredData TypeDescription
output_typefalseStringIndica el tipo del mensjae a agregar. Algunos ejemplos de datos pueden ser trust_feed_compact o trust_feed_full_image
titletrueStringIndica el título que tendrá el mensaje a agregar
texttrueStringIndica el texto infomativo que saldrá en nuestro mensaje
mediafalseStringCampo que contiene la URL de algún recurso que se desee adjuntar al mensaje, por ejemplo imágenes, videos, etc.
media_typefalseStringCampo encargado de indicar el tipo de recurso otorgado en la URL del campo media. Un ejemplo de valor puede ser img
action_typefalseStringCampo que indica la acción del mensaje. Por ejemplo, si la intención del mensaje es mostrar una URL para accederla, el valor que se debiese usar es url
action_textfalseStringCampo para indicar el texto o "label" del botón para el action_type otorgado
action_linkfalseStringCampo para indicar el enlace a acceder del action_type antes mencionado

Code Examples#

Para Compact Message:#

curl --location --request POST 'https://api.trust.lat/channels/v1/trust_feed/999-999999-999-9999-9-9/message' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer 4quUDNDnCiK0qS...' \
--data-raw '{
"output_type": "trust_feed_compact",
"title": "hola",
"text": "esto es un mensaje",
"media": "https://picsum.photos/200/300",
"media_type": "img",
"action_type": "url",
"action_text": "ir al sitio",
"action_link": "www.google.cl"
}'

Para Video Message:#

curl --location --request POST 'https://api.trust.lat/channels/v1/trust_feed/999-999999-999-9999-9-9/message' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer 4quUDNDnCiK0qS...' \
--data-raw '{
"output_type": "trust_feed_compact",
"title": "hola",
"text": "esto es un mensaje",
"media": "https://picsum.photos/200/300",
"media_type": "img",
"action_type": "url",
"action_text": "ir al sitio",
"action_link": "www.google.cl"
}'

Para Full_image:#

curl --location --request POST 'https://api.trust.lat/channels/v1/trust_feed/9999-999-99-999-999-999/message' \
--header 'Authorization: Bearer 4quUDNDnCiK0qS...' \
--header 'Content-Type: application/json' \
--data-raw '{
"output_type": "trust_feed_full_image",
"title": "lorem ipsum",
"text": "lorem ipsum",
"media": "https://picsum.photos/200/300",
"media_type": "img",
"action_type": "url",
"action_text": "ir al sitio",
"action_link": "www.google.cl"
}'

Responses#

COMPACT MESSAGE - HTTP CODE: 201 CREATED#

// Body payload
{
"text": "esto es un mensaje",
"media": "https://picsum.photos/200/300",
"media_type": "img",
"action_type": "click",
"action_link": "https://google.cl"
}
// Response
{
"code": 201,
"resource": "TrustFeedMessage",
"data": {
"action_link": "https://google.cl",
"action_text": "aaaaa",
"action_type": "click",
"created_at": "2020-09-22T20:17:44.237Z",
"media": "https://picsum.photos/200/300",
"media_type": "img",
"text": "esto es un mensaje",
"title": "hola",
"uuid": "99-999-9999-9-9-999-99-9999"
},
"message": "Created"
}

VIDEO MESSAGE - HTTP CODE: 201 CREATED#

// Body payload
{
"text": "esto es un mensaje",
"media": "https://picsum.photos/200/300",
"media_type": "img",
"action_type": "click",
"action_link": "https://google.cl"
}
// Response
{
"code": 201,
"resource": "TrustFeedMessage",
"data": {
"action_link": "https://google.cl",
"action_text": "aaaaa",
"action_type": "click",
"created_at": "2020-09-22T20:17:44.237Z",
"media": "https://picsum.photos/200/300",
"media_type": "img",
"text": "esto es un mensaje",
"title": "hola",
"uuid": "99-999-9999-9-9-999-99-9999"
},
"message": "Created"
}

FULL_IMAGE MESSAGE - HTTP CODE: 201 CREATED#

// Body payload
{
"text": "esto es un mensaje",
"media": "https://picsum.photos/200/300",
"media_type": "img",
"action_type": "click",
"action_link": "https://google.cl"
}
// Response
{
"code": 201,
"resource": "TrustFeedMessage",
"data": {
"action_link": "https://google.cl",
"action_text": "aaaaa",
"action_type": "click",
"created_at": "2020-09-22T20:17:44.237Z",
"media": "https://picsum.photos/200/300",
"media_type": "img",
"text": "esto es un mensaje",
"title": "hola",
"uuid": "99-999-9999-9-9-999-99-9999"
},
"message": "Created"
}
Last updated on by msepulvedav