Mensajes (MO)
Cuando el cliente le envíe un mensaje, Sinch Messaging API enviará una notificación de solicitud HTTP POST a la URL de Webhook con los detalles.
Es importante que su Webhook retorne una respuesta HTTPS 200 OK para las notificaciones (en un lapso de hasta 200 ms o de manera asíncrona). Caso contrario, la API de Sinch Messaging considerará esa notificación como una falla e intentará nuevamente.
Importante: Indicar el webhook donde recibirá los mensajes, para que nuestro equipo de soporte pueda asociarlo a su cuenta de Whatsapp
El formato de la respuesta será de acuerdo a la siguiente descripción:
total
Número de callbacks en la llamada.
String
data
Lista de mensajes originados en dispositivos móviles.
Data
Ejemplo de mensaje de texto:
{
"total": 1,
"data": [
{
"id": "ce425ffe-bc62-421f-9261-e6819a5eab43",
"source": "5519900000000",
"origin": "5519900000000",
"userProfile": {
"name": "nome do usuário"
},
"campaignId": 100,
"correlationId": "...",
"campaignAlias": "...",
"flowId": "....",
"extraInfo": "...",
"message": {
"type": "TEXT",
"messageText": "Olá, essa é uma mensagem do usuário."
},
"receivedAt": 1513616971473,
"receivedDate": "2017-12-18T17:09:31.473Z"
}
]
}
{
"total": 1,
"data": [
{
"id": "ce425ffe-bc62-421f-9261-e6819a5eab43",
"source": "5519900000000",
"origin": "5519900000000",
"userProfile": {
"name": "nome do usuário"
},
"campaignId": 100,
"correlationId": "...",
"campaignAlias": "...",
"flowId": "....",
"extraInfo": "...",
"message": {
"type": "TEXT",
"messageText": "Olá, essa é uma mensagem do usuário."
},
"receivedAt": 1513616971473,
"receivedDate": "2017-12-18T17:09:31.473Z"
}
]
}
{
"total": 1,
"data": [
{
"id": "ce425ffe-bc62-421f-9261-e6819a5eab43",
"source": "5519900000000",
"origin": "5519900000000",
"userProfile": {
"name": "nome do usuário"
},
"campaignId": 100,
"correlationId": "...",
"campaignAlias": "...",
"flowId": "....",
"extraInfo": "...",
"message": {
"type": "TEXT",
"messageText": "Olá, essa é uma mensagem do usuário."
},
"receivedAt": 1513616971473,
"receivedDate": "2017-12-18T17:09:31.473Z"
}
]
}
{
"total": 1,
"data": [
{
"id": "ce425ffe-bc62-421f-9261-e6819a5eab43",
"source": "5519900000000",
"origin": "5519900000000",
"userProfile": {
"name": "nome do usuário"
},
"campaignId": 100,
"correlationId": "...",
"campaignAlias": "...",
"flowId": "....",
"extraInfo": "...",
"message": {
"type": "TEXT",
"messageText": "Olá, essa é uma mensagem do usuário."
},
"receivedAt": 1513616971473,
"receivedDate": "2017-12-18T17:09:31.473Z"
}
]
}
{
"total": 1,
"data": [
{
"id": "ce425ffe-bc62-421f-9261-e6819a5eab43",
"source": "5519900000000",
"origin": "5519900000000",
"userProfile": {
"name": "nome do usuário"
},
"campaignId": 100,
"correlationId": "...",
"campaignAlias": "...",
"flowId": "....",
"extraInfo": "...",
"message": {
"type": "TEXT",
"messageText": "Olá, essa é uma mensagem do usuário."
},
"receivedAt": 1513616971473,
"receivedDate": "2017-12-18T17:09:31.473Z"
}
]
}
id
Última identificación del mensaje
String
source
Teléfono del remitente
String
origin
Teléfono que identifica la cuenta de WhatsApp (incluido el código de país). Ejemplo: 5411900000000.
String
userProfile
Perfil del usuario que envió el mensaje
UserProfile
correlationId
Un ID único configurado por usted para coincidir con el estado del mensaje (Callback y DLR). Este parámetro es opcional y puede usar el ID generado por Sinch Messaging para esta coincidencia.
String
campaignId
ID de campaña previamente definido.
String
campaignAlias
Alias de Campaña previamente definido.
String
message
Mensaje MO.
Message
receivedAt
Fecha en que se recibió el mensaje. Formato: yyyy-MM-dd’T'HH:mm:ssZ
String
receivedDate
Fecha en que se recibió el mensaje, utilizando el formato Unix_time
String
extraInfo
Información extra relacionada con el mensaje. Formato: Json
String
referral
Presente si el usuario inició el mensaje al hacer clic en una publicación o anuncio. Este campo es opcional (puede ser nulo).
Referral
mtSentAt
La marca de tiempo de la fecha/hora en que se envió el último MT a este destinatario.
Long
session
Información de la sesión.
Session
Ejemplo de mensaje con respuesta de botón:
{
"total":1,
"data":[
{
"id":"ce425ffe-bc62-421f-9261-e6819a5eab43",
"source":"5511900000000",
"origin":"5511900000000",
"userProfile":{
"name":"username",
"whatsAppId":"5511900000000"
},
"correlationId":"...",
"messageId":"aae959ca-5944-405a-809a-75ff142bc234",
"message":{
"type":"BUTTON",
"messageText":"Sim",
"payload":"sim"
},
"receivedAt":1513616971473,
"receivedDate":"2020-07-22T14:24:41Z",
"session":{
"id":"06deff90-cc27-11ea-b94f-0050569e62ca",
"createdAt":1513616971473
}
}
],
"clientInfo":{
"customerId":10,
"subAccountId":0,
"userId":101010
}
}
{
"total":1,
"data":[
{
"id":"ce425ffe-bc62-421f-9261-e6819a5eab43",
"source":"5511900000000",
"origin":"5511900000000",
"userProfile":{
"name":"username",
"whatsAppId":"5511900000000"
},
"correlationId":"...",
"messageId":"aae959ca-5944-405a-809a-75ff142bc234",
"message":{
"type":"BUTTON",
"messageText":"Sim",
"payload":"sim"
},
"receivedAt":1513616971473,
"receivedDate":"2020-07-22T14:24:41Z",
"session":{
"id":"06deff90-cc27-11ea-b94f-0050569e62ca",
"createdAt":1513616971473
}
}
],
"clientInfo":{
"customerId":10,
"subAccountId":0,
"userId":101010
}
}
{
"total":1,
"data":[
{
"id":"ce425ffe-bc62-421f-9261-e6819a5eab43",
"source":"5511900000000",
"origin":"5511900000000",
"userProfile":{
"name":"username",
"whatsAppId":"5511900000000"
},
"correlationId":"...",
"messageId":"aae959ca-5944-405a-809a-75ff142bc234",
"message":{
"type":"BUTTON",
"messageText":"Sim",
"payload":"sim"
},
"receivedAt":1513616971473,
"receivedDate":"2020-07-22T14:24:41Z",
"session":{
"id":"06deff90-cc27-11ea-b94f-0050569e62ca",
"createdAt":1513616971473
}
}
],
"clientInfo":{
"customerId":10,
"subAccountId":0,
"userId":101010
}
}
{
"total":1,
"data":[
{
"id":"ce425ffe-bc62-421f-9261-e6819a5eab43",
"source":"5511900000000",
"origin":"5511900000000",
"userProfile":{
"name":"username",
"whatsAppId":"5511900000000"
},
"correlationId":"...",
"messageId":"aae959ca-5944-405a-809a-75ff142bc234",
"message":{
"type":"BUTTON",
"messageText":"Sim",
"payload":"sim"
},
"receivedAt":1513616971473,
"receivedDate":"2020-07-22T14:24:41Z",
"session":{
"id":"06deff90-cc27-11ea-b94f-0050569e62ca",
"createdAt":1513616971473
}
}
],
"clientInfo":{
"customerId":10,
"subAccountId":0,
"userId":101010
}
}
{
"total":1,
"data":[
{
"id":"ce425ffe-bc62-421f-9261-e6819a5eab43",
"source":"5511900000000",
"origin":"5511900000000",
"userProfile":{
"name":"username",
"whatsAppId":"5511900000000"
},
"correlationId":"...",
"messageId":"aae959ca-5944-405a-809a-75ff142bc234",
"message":{
"type":"BUTTON",
"messageText":"Sim",
"payload":"sim"
},
"receivedAt":1513616971473,
"receivedDate":"2020-07-22T14:24:41Z",
"session":{
"id":"06deff90-cc27-11ea-b94f-0050569e62ca",
"createdAt":1513616971473
}
}
],
"clientInfo":{
"customerId":10,
"subAccountId":0,
"userId":101010
}
}
Referral
Todos los campos de este objeto son opcionales (pueden ser nulos).
headLine
Titular del anuncio que generó el mensaje.
String
body
Cuerpo del anuncio.
String
sourceType
Tipo de anuncio. Puede ser “ad”, “post” o “unknown”.
String
sourceId
Identificación de anuncio o publicación en Facebook.
String
sourceUrl
URL del anuncio o publicación.
String
mediaType
Tipo de medio presente en el anuncio. Puede ser “image” o “video”.
String
mediaUrl
Url del medio presente en el anuncio.
String
Ejemplo de mensaje de texto de referral:
{
"total": 1,
"data": [
{
"id": "ce425ffe-bc62-421f-9261-e6819a5eab43",
"source": "5519900000000",
"origin": "5519900000000",
"userProfile": {
"name": "name of the user"
},
"campaignId": 100,
"correlationId": "...",
"campaignAlias": "...",
"flowId": "....",
"extraInfo": "...",
"referral": {
"headLine": "...",
"body": "...",
"sourceType": "...",
"sourceId": "...",
"sourceUrl": "...",
"mediaType": "...",
"mediaUrl": "..."
},
"mtSentAt": 1513616971473,
"message": {
"type": "TEXT",
"messageText": "Hi, this is a message from the user"
},
"receivedAt": 1513616971473,
"receivedDate": "2017-12-18T17:09:31.473Z"
}
]
}
{
"total": 1,
"data": [
{
"id": "ce425ffe-bc62-421f-9261-e6819a5eab43",
"source": "5519900000000",
"origin": "5519900000000",
"userProfile": {
"name": "name of the user"
},
"campaignId": 100,
"correlationId": "...",
"campaignAlias": "...",
"flowId": "....",
"extraInfo": "...",
"referral": {
"headLine": "...",
"body": "...",
"sourceType": "...",
"sourceId": "...",
"sourceUrl": "...",
"mediaType": "...",
"mediaUrl": "..."
},
"mtSentAt": 1513616971473,
"message": {
"type": "TEXT",
"messageText": "Hi, this is a message from the user"
},
"receivedAt": 1513616971473,
"receivedDate": "2017-12-18T17:09:31.473Z"
}
]
}
{
"total": 1,
"data": [
{
"id": "ce425ffe-bc62-421f-9261-e6819a5eab43",
"source": "5519900000000",
"origin": "5519900000000",
"userProfile": {
"name": "name of the user"
},
"campaignId": 100,
"correlationId": "...",
"campaignAlias": "...",
"flowId": "....",
"extraInfo": "...",
"referral": {
"headLine": "...",
"body": "...",
"sourceType": "...",
"sourceId": "...",
"sourceUrl": "...",
"mediaType": "...",
"mediaUrl": "..."
},
"mtSentAt": 1513616971473,
"message": {
"type": "TEXT",
"messageText": "Hi, this is a message from the user"
},
"receivedAt": 1513616971473,
"receivedDate": "2017-12-18T17:09:31.473Z"
}
]
}
{
"total": 1,
"data": [
{
"id": "ce425ffe-bc62-421f-9261-e6819a5eab43",
"source": "5519900000000",
"origin": "5519900000000",
"userProfile": {
"name": "name of the user"
},
"campaignId": 100,
"correlationId": "...",
"campaignAlias": "...",
"flowId": "....",
"extraInfo": "...",
"referral": {
"headLine": "...",
"body": "...",
"sourceType": "...",
"sourceId": "...",
"sourceUrl": "...",
"mediaType": "...",
"mediaUrl": "..."
},
"mtSentAt": 1513616971473,
"message": {
"type": "TEXT",
"messageText": "Hi, this is a message from the user"
},
"receivedAt": 1513616971473,
"receivedDate": "2017-12-18T17:09:31.473Z"
}
]
}
{
"total": 1,
"data": [
{
"id": "ce425ffe-bc62-421f-9261-e6819a5eab43",
"source": "5519900000000",
"origin": "5519900000000",
"userProfile": {
"name": "name of the user"
},
"campaignId": 100,
"correlationId": "...",
"campaignAlias": "...",
"flowId": "....",
"extraInfo": "...",
"referral": {
"headLine": "...",
"body": "...",
"sourceType": "...",
"sourceId": "...",
"sourceUrl": "...",
"mediaType": "...",
"mediaUrl": "..."
},
"mtSentAt": 1513616971473,
"message": {
"type": "TEXT",
"messageText": "Hi, this is a message from the user"
},
"receivedAt": 1513616971473,
"receivedDate": "2017-12-18T17:09:31.473Z"
}
]
}
Session
sessionId
ID de sesión para este usuario.
String
createdAt
Marca de tiempo de creación de la sesión.
Long
Mensaje:
type
Tipo de mensaje enviado por el usuario final: TEXT - IMAGE - AUDIO - DOCUMENT
String
messageText
El mensaje de texto (MO) enviado por el usuario final.
String
mediaUrl
Url para descargar la multimedia enviada por el usuario final.
String
mimeType
Tipo de archivo enviado por el usuario final.
String
caption
Etiqueta de multimedia enviada por el usuario final.
String
location
Ubicación enviada por el usuario final.
Location
contacts
Contactos enviados por el usuario final.
Contact[]
Ejemplo de mensaje multimedia
{
"total": 1,
"data": [
{
"id": "ce425ffe-bc62-421f-9261-e6819a5eab43",
"source": "5519900000000",
"origin": "5519900000000",
"userProfile": {
"name": "nome do usuário"
},
"campaignId": 100,
"correlationId": "...",
"campaignAlias": "...",
"flowId": "....",
"extraInfo": "...",
"message": {
"type": "IMAGE",
"mediaUrl": "https://...",
"mimeType": "image/jpg",
"caption": "..."
},
"receivedAt": 1513616971473,
"receivedDate": "2017-12-18T17:09:31.473Z"
}
]
}
{
"total": 1,
"data": [
{
"id": "ce425ffe-bc62-421f-9261-e6819a5eab43",
"source": "5519900000000",
"origin": "5519900000000",
"userProfile": {
"name": "nome do usuário"
},
"campaignId": 100,
"correlationId": "...",
"campaignAlias": "...",
"flowId": "....",
"extraInfo": "...",
"message": {
"type": "IMAGE",
"mediaUrl": "https://...",
"mimeType": "image/jpg",
"caption": "..."
},
"receivedAt": 1513616971473,
"receivedDate": "2017-12-18T17:09:31.473Z"
}
]
}
{
"total": 1,
"data": [
{
"id": "ce425ffe-bc62-421f-9261-e6819a5eab43",
"source": "5519900000000",
"origin": "5519900000000",
"userProfile": {
"name": "nome do usuário"
},
"campaignId": 100,
"correlationId": "...",
"campaignAlias": "...",
"flowId": "....",
"extraInfo": "...",
"message": {
"type": "IMAGE",
"mediaUrl": "https://...",
"mimeType": "image/jpg",
"caption": "..."
},
"receivedAt": 1513616971473,
"receivedDate": "2017-12-18T17:09:31.473Z"
}
]
}
{
"total": 1,
"data": [
{
"id": "ce425ffe-bc62-421f-9261-e6819a5eab43",
"source": "5519900000000",
"origin": "5519900000000",
"userProfile": {
"name": "nome do usuário"
},
"campaignId": 100,
"correlationId": "...",
"campaignAlias": "...",
"flowId": "....",
"extraInfo": "...",
"message": {
"type": "IMAGE",
"mediaUrl": "https://...",
"mimeType": "image/jpg",
"caption": "..."
},
"receivedAt": 1513616971473,
"receivedDate": "2017-12-18T17:09:31.473Z"
}
]
}
{
"total": 1,
"data": [
{
"id": "ce425ffe-bc62-421f-9261-e6819a5eab43",
"source": "5519900000000",
"origin": "5519900000000",
"userProfile": {
"name": "nome do usuário"
},
"campaignId": 100,
"correlationId": "...",
"campaignAlias": "...",
"flowId": "....",
"extraInfo": "...",
"message": {
"type": "IMAGE",
"mediaUrl": "https://...",
"mimeType": "image/jpg",
"caption": "..."
},
"receivedAt": 1513616971473,
"receivedDate": "2017-12-18T17:09:31.473Z"
}
]
}
UserProfile:
name
No
El nombre del perfil del usuario
String
Location:
name
Nombre del sitio.
String
address
Dirección del sitio.
String
geoPoint
Geopoint enviada por el usuario final. Formato: “latitud, longitud”
String
Ejemplo de mensaje de ubicación:
{
"total": 1,
"data": [
{
"id": "ce425ffe-bc62-421f-9261-e6819a5eab43",
"source": "5519900000000",
"origin": "5519900000000",
"userProfile": {
"name": "nome do usuário"
},
"campaignId": 100,
"correlationId": "...",
"campaignAlias": "...",
"flowId": "....",
"extraInfo": "...",
"message": {
"location": {
"geoPoint": "-22.894180,-47.047960",
"name": "Sinch",
"address": "Av. Cel. Silva Telles"
}
},
"receivedAt": 1513616971473,
"receivedDate": "2017-12-18T17:09:31.473Z"
}
]
}
{
"total": 1,
"data": [
{
"id": "ce425ffe-bc62-421f-9261-e6819a5eab43",
"source": "5519900000000",
"origin": "5519900000000",
"userProfile": {
"name": "nome do usuário"
},
"campaignId": 100,
"correlationId": "...",
"campaignAlias": "...",
"flowId": "....",
"extraInfo": "...",
"message": {
"location": {
"geoPoint": "-22.894180,-47.047960",
"name": "Wavy",
"address": "Av. Cel. Silva Telles"
}
},
"receivedAt": 1513616971473,
"receivedDate": "2017-12-18T17:09:31.473Z"
}
]
}
{
"total": 1,
"data": [
{
"id": "ce425ffe-bc62-421f-9261-e6819a5eab43",
"source": "5519900000000",
"origin": "5519900000000",
"userProfile": {
"name": "nome do usuário"
},
"campaignId": 100,
"correlationId": "...",
"campaignAlias": "...",
"flowId": "....",
"extraInfo": "...",
"message": {
"location": {
"geoPoint": "-22.894180,-47.047960",
"name": "Wavy",
"address": "Av. Cel. Silva Telles"
}
},
"receivedAt": 1513616971473,
"receivedDate": "2017-12-18T17:09:31.473Z"
}
]
}
{
"total": 1,
"data": [
{
"id": "ce425ffe-bc62-421f-9261-e6819a5eab43",
"source": "5519900000000",
"origin": "5519900000000",
"userProfile": {
"name": "nome do usuário"
},
"campaignId": 100,
"correlationId": "...",
"campaignAlias": "...",
"flowId": "....",
"extraInfo": "...",
"message": {
"location": {
"geoPoint": "-22.894180,-47.047960",
"name": "Wavy",
"address": "Av. Cel. Silva Telles"
}
},
"receivedAt": 1513616971473,
"receivedDate": "2017-12-18T17:09:31.473Z"
}
]
}
{
"total": 1,
"data": [
{
"id": "ce425ffe-bc62-421f-9261-e6819a5eab43",
"source": "5519900000000",
"origin": "5519900000000",
"userProfile": {
"name": "nome do usuário"
},
"campaignId": 100,
"correlationId": "...",
"campaignAlias": "...",
"flowId": "....",
"extraInfo": "...",
"message": {
"location": {
"geoPoint": "-22.894180,-47.047960",
"name": "Wavy",
"address": "Av. Cel. Silva Telles"
}
},
"receivedAt": 1513616971473,
"receivedDate": "2017-12-18T17:09:31.473Z"
}
]
}
Contact:
addresses
No
Direcciones de contacto completas.
Address[]
birthday
No
Fecha de cumpleaños como cadena con formato YYYY-MM-DD.
String
emails
No
Direcciones de correo electrónico de contacto.
Email[]
name
No
Nombre completo de contacto.
Name
org
No
Información de la organización de contacto.
Org
phones
No
Teléfonos de contacto.
Phone[]
urls
No
URLs de los contactos.
Url[]
Ejemplo de mensaje de contacto:
{
"total": 1,
"data": [
{
"id": "ce425ffe-bc62-421f-9261-e6819a5eab43",
"source": "5519900000000",
"origin": "5519900000000",
"userProfile": {
"name": "nome do usuário"
},
"campaignId": 100,
"correlationId": "...",
"campaignAlias": "...",
"flowId": "....",
"extraInfo": "...",
"message": {
"contacts":[
{
"addresses":[
{
"city":"Menlo Park",
"country":"United States",
"country_code":"us",
"state":"CA",
"street":"1 Hacker Way",
"type":"HOME",
"zip":"94025"
},
{
"city":"Menlo Park",
"country":"United States",
"country_code":"us",
"state":"CA",
"street":"200 Jefferson Dr",
"type":"WORK",
"zip":"94025"
}
],
"birthday":"2012-08-18",
"emails":[
{
"email":"test@fb.com",
"type":"WORK"
},
{
"email":"test@whatsapp.com",
"type":"WORK"
}
],
"name":{
"first_name":"John",
"formatted_name":"John Smith",
"last_name":"Smith"
},
"org":{
"company":"WhatsApp",
"department":"Design",
"title":"Manager"
},
"phones":[
{
"phone":"+1 (940) 555-1234",
"type":"HOME"
},
{
"phone":"+1 (650) 555-1234",
"type":"WORK",
"wa_id":"16505551234"
}
],
"urls":[
{
"url":"https://www.fb.com",
"type":"WORK"
}
]
}
]
},
"receivedAt": 1513616971473,
"receivedDate": "2017-12-18T17:09:31.473Z"
}
]
}
{
"total": 1,
"data": [
{
"id": "ce425ffe-bc62-421f-9261-e6819a5eab43",
"source": "5519900000000",
"origin": "5519900000000",
"userProfile": {
"name": "nome do usuário"
},
"campaignId": 100,
"correlationId": "...",
"campaignAlias": "...",
"flowId": "....",
"extraInfo": "...",
"message": {
"contacts":[
{
"addresses":[
{
"city":"Menlo Park",
"country":"United States",
"country_code":"us",
"state":"CA",
"street":"1 Hacker Way",
"type":"HOME",
"zip":"94025"
},
{
"city":"Menlo Park",
"country":"United States",
"country_code":"us",
"state":"CA",
"street":"200 Jefferson Dr",
"type":"WORK",
"zip":"94025"
}
],
"birthday":"2012-08-18",
"emails":[
{
"email":"test@fb.com",
"type":"WORK"
},
{
"email":"test@whatsapp.com",
"type":"WORK"
}
],
"name":{
"first_name":"John",
"formatted_name":"John Smith",
"last_name":"Smith"
},
"org":{
"company":"WhatsApp",
"department":"Design",
"title":"Manager"
},
"phones":[
{
"phone":"+1 (940) 555-1234",
"type":"HOME"
},
{
"phone":"+1 (650) 555-1234",
"type":"WORK",
"wa_id":"16505551234"
}
],
"urls":[
{
"url":"https://www.fb.com",
"type":"WORK"
}
]
}
]
},
"receivedAt": 1513616971473,
"receivedDate": "2017-12-18T17:09:31.473Z"
}
]
}
{
"total": 1,
"data": [
{
"id": "ce425ffe-bc62-421f-9261-e6819a5eab43",
"source": "5519900000000",
"origin": "5519900000000",
"userProfile": {
"name": "nome do usuário"
},
"campaignId": 100,
"correlationId": "...",
"campaignAlias": "...",
"flowId": "....",
"extraInfo": "...",
"message": {
"contacts":[
{
"addresses":[
{
"city":"Menlo Park",
"country":"United States",
"country_code":"us",
"state":"CA",
"street":"1 Hacker Way",
"type":"HOME",
"zip":"94025"
},
{
"city":"Menlo Park",
"country":"United States",
"country_code":"us",
"state":"CA",
"street":"200 Jefferson Dr",
"type":"WORK",
"zip":"94025"
}
],
"birthday":"2012-08-18",
"emails":[
{
"email":"test@fb.com",
"type":"WORK"
},
{
"email":"test@whatsapp.com",
"type":"WORK"
}