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
Key | Value | Description |
---|---|---|
Content-Type | application/json | |
Authorization | Bearer {{access_token}} | access_token obtained in Atenea |
Method: POST
URL: https://api.trust.lat/v1/trust_feed/:trust_feed_uuid/message
URL Variables:
Key | Description |
---|---|
trust_feed_uuid | uuid 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
Body
Como se mencionó antes, existen muchos tipos de mensajes, a continuación se mostrará ejemplos del payload para cada uno:
- Compact
- Video
- Full Image
{
"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"
}
{
"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"
}
{
"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"
}
Descripcíón de campos
Key | Required | Data Type | Description |
---|---|---|---|
output_type | false | String | Indica el tipo del mensjae a agregar. Algunos ejemplos de datos pueden ser trust_feed_compact o trust_feed_full_image |
title | true | String | Indica el título que tendrá el mensaje a agregar |
text | true | String | Indica el texto infomativo que saldrá en nuestro mensaje |
media | false | String | Campo que contiene la URL de algún recurso que se desee adjuntar al mensaje, por ejemplo imágenes, videos, etc. |
media_type | false | String | Campo encargado de indicar el tipo de recurso otorgado en la URL del campo media. Un ejemplo de valor puede ser img |
action_type | false | String | Campo 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_text | false | String | Campo para indicar el texto o "label" del botón para el action_type otorgado |
action_link | false | String | Campo para indicar el enlace a acceder del action_type antes mencionado |
Code Examples
Para Compact Message:
- Curl
- JavaScript
- Python
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"
}'
import requests
url = "https://api.trust.lat/channels/v1/trust_feed/999-999999-999-9999-9-9/message"
payload="{\n \"output_type\": \"trust_feed_compact\",\n\t\"title\": \"hola\",\n\t\"text\": \"esto es un mensaje\",\n\t\"media\": \"https://picsum.photos/200/300\",\n\t\"media_type\": \"img\",\n\t\"action_type\": \"url\",\n\t\"action_text\": \"ir al sitio\",\n\t\"action_link\": \"www.google.cl\"\n}"
headers = {
'Authorization': 'Bearer 4quUDNDnCiK0qS...',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
var axios = require('axios');
var data = JSON.stringify({"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"});
var config = {
method: 'post',
url: 'https://api.trust.lat/channels/v1/trust_feed/999-999999-999-9999-9-9/message',
headers: {
'Authorization': 'Bearer 4quUDNDnCiK0qS...',
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Para Video Message:
- Curl
- JavaScript
- Python
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"
}'
import requests
url = "https://api.trust.lat/channels/v1/trust_feed/999-999999-999-9999-9-9/message"
payload="{\n \"output_type\": \"trust_feed_compact\",\n\t\"title\": \"hola\",\n\t\"text\": \"esto es un mensaje\",\n\t\"media\": \"https://picsum.photos/200/300\",\n\t\"media_type\": \"img\",\n\t\"action_type\": \"url\",\n\t\"action_text\": \"ir al sitio\",\n\t\"action_link\": \"www.google.cl\"\n}"
headers = {
'Authorization': 'Bearer 4quUDNDnCiK0qS...',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
var axios = require('axios');
var data = JSON.stringify({"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"});
var config = {
method: 'post',
url: 'https://api.trust.lat/channels/v1/trust_feed/999-999999-999-9999-9-9/message',
headers: {
'Authorization': 'Bearer 4quUDNDnCiK0qS...',
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Para Full_image:
- Curl
- JavaScript
- Python
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"
}'
import requests
url = "https://api.trust.lat/channels/v1/trust_feed/9999-999-99-999-999-999/message"
payload="{\n \"output_type\": \"trust_feed_full_image\",\n\t\"title\": \"lorem ipsum\",\n\t\"text\": \"lorem ipsum\",\n\t\"media\": \"https://picsum.photos/200/300\",\n\t\"media_type\": \"img\",\n\t\"action_type\": \"url\",\n\t\"action_text\": \"ir al sitio\",\n\t\"action_link\": \"www.google.cl\"\n}"
headers = {
'Authorization': 'Bearer 4quUDNDnCiK0qS...',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
var axios = require('axios');
var data = JSON.stringify({"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"});
var config = {
method: 'post',
url: 'https://api.trust.lat/channels/v1/trust_feed/9999-999-99-999-999-999/message',
headers: {
'Authorization': 'Bearer 4quUDNDnCiK0qS...',
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Responses
COMPACT MESSAGE - HTTP CODE: 201 CREATED
- Added
- Added/Email
- Added/Call
// 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"
}
// Body payload
{
"output_type": "trust_feed_full_image",
"title": "hola",
"text": "esto es un mensaje",
"media": "https://estaticos.muyinteresante.es/media/cache/1140x_thumb/uploads/images/gallery/59c4f5655bafe82c692a7052/gato-marron_0.jpg",
"media_type": "img",
"action_type": "email",
"action_text": "correo",
"action_link": "cuenta@trust.lat"
}
// Response
{
"code": 201,
"resource": "TrustFeedMessage",
"data": {
"action_link": "cuenta@trust.lat",
"action_text": "correo",
"action_type": "email",
"created_at": "2020-10-01T17:47:05.678Z",
"media": "https://estaticos.muyinteresante.es/media/cache/1140x_thumb/uploads/images/gallery/59c4f5655bafe82c692a7052/gato-marron_0.jpg",
"media_type": "img",
"output_type": "trust_feed_full_image",
"text": "esto es un mensaje",
"title": "hola",
"uuid": "99999-99-999999-999-9-99999"
},
"message": "Created"
}
// Body payload
{
"output_type": "trust_feed_full_image",
"title": "hola",
"text": "esto es un mensaje",
"media": "https://estaticos.muyinteresante.es/media/cache/1140x_thumb/uploads/images/gallery/59c4f5655bafe82c692a7052/gato-marron_0.jpg",
"media_type": "img",
"action_type": "call",
"action_text": "ir a la web",
"action_link": "+56999999999"
}
// Response
{
"code": 201,
"resource": "TrustFeedMessage",
"data": {
"action_link": "https://google.cl",
"action_text": "ir a la web",
"action_type": "click",
"created_at": "2020-10-01T15:42:10.866Z",
"media": "https://picsum.photos/200/300",
"media_type": "img",
"output_type": "trust_feed_full_image",
"text": "esto es un mensaje",
"title": "hola",
"uuid": "9999-999-9-9999-999-999"
},
"message": "Created"
}
VIDEO MESSAGE - HTTP CODE: 201 CREATED
- Added
- Added/Email
- Added/Call
// 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"
}
// Body payload
{
"output_type": "trust_feed_full_image",
"title": "hola",
"text": "esto es un mensaje",
"media": "https://estaticos.muyinteresante.es/media/cache/1140x_thumb/uploads/images/gallery/59c4f5655bafe82c692a7052/gato-marron_0.jpg",
"media_type": "img",
"action_type": "email",
"action_text": "correo",
"action_link": "cuenta@trust.lat"
}
// Response
{
"code": 201,
"resource": "TrustFeedMessage",
"data": {
"action_link": "cuenta@trust.lat",
"action_text": "correo",
"action_type": "email",
"created_at": "2020-10-01T17:47:05.678Z",
"media": "https://estaticos.muyinteresante.es/media/cache/1140x_thumb/uploads/images/gallery/59c4f5655bafe82c692a7052/gato-marron_0.jpg",
"media_type": "img",
"output_type": "trust_feed_full_image",
"text": "esto es un mensaje",
"title": "hola",
"uuid": "99-99-99999-99-99-999-9-99"
},
"message": "Created"
}
// Body payload
{
"output_type": "trust_feed_full_image",
"title": "hola",
"text": "esto es un mensaje",
"media": "https://estaticos.muyinteresante.es/media/cache/1140x_thumb/uploads/images/gallery/59c4f5655bafe82c692a7052/gato-marron_0.jpg",
"media_type": "img",
"action_type": "call",
"action_text": "ir a la web",
"action_link": "+56999999999"
}
// Response
{
"code": 201,
"resource": "TrustFeedMessage",
"data": {
"action_link": "https://google.cl",
"action_text": "ir a la web",
"action_type": "click",
"created_at": "2020-10-01T15:42:10.866Z",
"media": "https://picsum.photos/200/300",
"media_type": "img",
"output_type": "trust_feed_full_image",
"text": "esto es un mensaje",
"title": "hola",
"uuid": "99-99-99-9999-999-999"
},
"message": "Created"
}
FULL_IMAGE MESSAGE - HTTP CODE: 201 CREATED
- Added
- Added/Email
- Added/Call
// 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"
}
// Body payload
{
"output_type": "trust_feed_full_image",
"title": "hola",
"text": "esto es un mensaje",
"media": "https://estaticos.muyinteresante.es/media/cache/1140x_thumb/uploads/images/gallery/59c4f5655bafe82c692a7052/gato-marron_0.jpg",
"media_type": "img",
"action_type": "email",
"action_text": "correo",
"action_link": "cuenta@trust.lat"
}
// Response
{
"code": 201,
"resource": "TrustFeedMessage",
"data": {
"action_link": "cuenta@trust.lat",
"action_text": "correo",
"action_type": "email",
"created_at": "2020-10-01T17:47:05.678Z",
"media": "https://estaticos.muyinteresante.es/media/cache/1140x_thumb/uploads/images/gallery/59c4f5655bafe82c692a7052/gato-marron_0.jpg",
"media_type": "img",
"output_type": "trust_feed_full_image",
"text": "esto es un mensaje",
"title": "hola",
"uuid": "99-99-99999-99-99-999-9-99"
},
"message": "Created"
}
// Body payload
{
"output_type": "trust_feed_full_image",
"title": "hola",
"text": "esto es un mensaje",
"media": "https://estaticos.muyinteresante.es/media/cache/1140x_thumb/uploads/images/gallery/59c4f5655bafe82c692a7052/gato-marron_0.jpg",
"media_type": "img",
"action_type": "call",
"action_text": "ir a la web",
"action_link": "+56999999999"
}
// Response
{
"code": 201,
"resource": "TrustFeedMessage",
"data": {
"action_link": "https://google.cl",
"action_text": "ir a la web",
"action_type": "click",
"created_at": "2020-10-01T15:42:10.866Z",
"media": "https://picsum.photos/200/300",
"media_type": "img",
"output_type": "trust_feed_full_image",
"text": "esto es un mensaje",
"title": "hola",
"uuid": "99-99-99-9999-999-999"
},
"message": "Created"
}