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:

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"
    }
  ]
}

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
            }
  }

Referral

Todos los campos de este objeto son opcionales (pueden ser nulos).

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"
    }
  ]
}

Session

Mensaje:

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"
    }
  ]
}

UserProfile:

Location:

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"
    }
  ]
}

Contact:

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"
    }
  ]
}