Keyword (Webhook WhatsApp)

In this section we are going to show the data that is sent from the platform to your webhook URL, which must be configured to handle the contents provided in the JSON payload. That is, the webhook allows you to forward data to your application for further processing.

The payload sent to the webhook URL varies depending on the message type received from the end user.

📘

NOTE

These JSON payloads will be sent to the Webhook URL if you opt for WhatsApp as delivery channel when creating and setting as Live a keyword campaign.

For example, when the end user sends any of the following message types, the JSON payload will vary.

  • Send a simple text with emojis and line breaks
{
  "owner": "[email protected]",
  "date": "2023-12-12T18:58:44.819365532Z",
  "processId": 2222,
  "origin": "5500000000",
  "externalId": "[email protected]_111",
  "callback": "https://webhook/111",
  "id": "1122334455",
  "text": "We are pleased to present our new product: \nThe Amplifier 480xAr 😀",
  "user": "525511111111",
  "extraInfo": {
    "SAMWELL_WEBHOOK_NAME": "Webhook Orders",
    "MSGI_SOURCE_CAMPAIGN": "SKC",
    "contacts": [
      {
        "profile": {
          "name": "Alex Smith"
        },
        "wa_id": "525511111111"
      }
    ]
  }
}
ParameterDescription
ownerInteractive Campaign owner.
dateDate when the API receives the WhatsApp message status.

The date is represented with date in UTC Zulu format: (yyyy-mm-dd-Thh:mm:ss.ssZ).
processIdUnique identifier of the process (event).
originPhone number used to originate and send the whatsApp message.
externalIdAlphanumeric identifier used to identify your whatsApp messages uniquely for reporting purposes.
callbackWebhook URL to notify about the events of the whatsApp message.
idUnique identifier provided by META
textContent of the WhatsApp message sent by the end user.

In case the sent message does not support META, it will display the following message value:

"text": "The message type is not currently supported by META"
userPhone number of the end user.
extraInfoAdditional information sent by the end user from the WhatsApp application.
extraInfo.SAMWELL_WEBHOOK_NAMEWebhook name you typed when setting up the Keyword campaign.
extraInfo.MSGI_SOURCE_CAMPAIGNType of interactive campaign from which the message is received.

- "SKC": Keyword interactive campaign
extraInfo.contactsEnd user information.
extraInfo.contacts.profileEnd user profile
extraInfo.contacts.profile.nameName of the end user.
extraInfo.contacts.wa_idPhone number of the end user.
  • Send a Sticker
{
  "owner": "[email protected]",
  "date": "2023-12-12T18:58:44.819365532Z",
  "processId": 2222,
  "origin": "5500000000",
  "externalId": "[email protected]_111",
  "callback": "https://webhook/111",
  "id": "1122334455",
  "text": "",
  "user": "525511111111",
  "extraInfo": {
    "SAMWELL_WEBHOOK_NAME": "Webhook Orders",
    "MSGI_SOURCE_CAMPAIGN": "SKC",
    "sticker": {
      "fileName": "121212_File.webp",
      "shaData": "234567898765434567",
      "url": "https://whatsapp-mo-attachments.awsDomain.com/121212_File",
      "caption": ""
    },
    "contacts": [
      {
        "profile": {
          "name": "Alex Smith"
        },
        "wa_id": "525511111111"
      }
    ]
  }
}
ParameterDescription
ownerInteractive Campaign owner.
dateDate when the API receives the WhatsApp message status.

The date is represented with date in UTC Zulu format: (yyyy-mm-dd-Thh:mm:ss.ssZ).
processIdUnique identifier of the process (event).
originPhone number used to originate and send the whatsApp message.
externalIdAlphanumeric identifier used to identify your whatsApp messages uniquely for reporting purposes.
callbackWebhook URL to notify about the events of the whatsApp message.
idUnique identifier provided by META
textContent of the WhatsApp message sent by the end user.

In case the sent message does not support META, it will display the following message value:

"text": "The message type is not currently supported by META"
userPhone number of the end user.
extraInfoAdditional information sent by the end user from the WhatsApp application.
extraInfo.SAMWELL_WEBHOOK_NAMEWebhook name you typed when setting up the Keyword campaign.
extraInfo.MSGI_SOURCE_CAMPAIGNType of interactive campaign from which the message is received.

- "SKC": Keyword interactive campaign
extraInfo.stickerSticker information
extraInfo.sticker.fileNameName of the sticker
extraInfo.sticker.shaDataOptional.

Verify if the sticker is secure according to Secure Hash Algorithms (SHA).
extraInfo.sticker.urlURL of a sticker sent in a WhatsApp message.
extraInfo.contactsEnd user information.
extraInfo.contacts.profileEnd user profile
extraInfo.contacts.profile.nameName of the end user.
extraInfo.contacts.wa_idPhone number of the end user.
  • Attach an Image or PDF file
{
  "owner": "[email protected]",
  "date": "2023-12-12T18:58:44.819365532Z",
  "processId": 2222,
  "origin": "5500000000",
  "externalId": "[email protected]_111",
  "callback": "https://webhook/111",
  "id": "1122334455",
  "text": "",
  "user": "525511111111",
  "extraInfo": {
    "SAMWELL_WEBHOOK_NAME": "Webhook Orders",
    "MSGI_SOURCE_CAMPAIGN": "SKC",
    "attachments": [
      {
        "fileName": "14444_File.pdf",
        "shaData": "234567898765434567",
        "url": "https://whatsapp-mo-attachments.awsDomain.com/14444_File",
        "caption": ""
      }
    ],
    "contacts": [
      {
        "profile": {
          "name": "Alex Smith"
        },
        "wa_id": "525511111111"
      }
    ]
  }
}
ParameterDescription
ownerInteractive Campaign owner.
dateDate when the API receives the WhatsApp message status.

The date is represented with date in UTC Zulu format: (yyyy-mm-dd-Thh:mm:ss.ssZ).
processIdUnique identifier of the process (event).
originPhone number used to originate and send the whatsApp message.
externalIdAlphanumeric identifier used to identify your whatsApp messages uniquely for reporting purposes.
callbackWebhook URL to notify about the events of the whatsApp message.
idUnique identifier provided by META
textContent of the WhatsApp message sent by the end user.

In case the sent message does not support META, it will display the following message value:

"text": "The message type is not currently supported by META"
userPhone number of the end user.
extraInfoAdditional information sent by the end user from the WhatsApp application.
extraInfo.SAMWELL_WEBHOOK_NAMEWebhook name you typed when setting up the Keyword campaign.
extraInfo.MSGI_SOURCE_CAMPAIGNType of interactive campaign from which the message is received.

- "SKC": Keyword interactive campaign
extraInfo.attachmentsAttachment files information.
extraInfo.attachments.fileNameFile name and type.
extraInfo.attachments.shaDataOptional.

Verify if the file is secure according to Secure Hash Algorithms (SHA).
extraInfo.attachments.urlURL of the image or pdf file sent in a WhatsApp message.
extraInfo.contactsEnd user information.
extraInfo.contacts.profileEnd user profile
extraInfo.contacts.profile.nameName of the end user.
extraInfo.contacts.wa_idPhone number of the end user.
  • Send a Location
{
  "owner": "[email protected]",
  "date": "2023-12-12T18:58:44.819365532Z",
  "processId": 2222,
  "origin": "5500000000",
  "externalId": "[email protected]_111",
  "callback": "https://webhook/111",
  "id": "1122334455",
  "text": "",
  "user": "525511111111",
  "extraInfo": {
    "SAMWELL_WEBHOOK_NAME": "Webhook Orders",
    "MSGI_SOURCE_CAMPAIGN": "SKC",
    "location": {
      "longitude": "-99.140907",
      "latitude": "19.435156",
      "name": null,
      "address": null
    },
    "contacts": [
      {
        "profile": {
          "name": "Alex Smith"
        },
        "wa_id": "525511111111"
      }
    ]
  }
}
ParameterDescription
ownerInteractive Campaign owner.
dateDate when the API receives the WhatsApp message status.

The date is represented with date in UTC Zulu format: (yyyy-mm-dd-Thh:mm:ss.ssZ).
processIdUnique identifier of the process (event).
originPhone number used to originate and send the whatsApp message.
externalIdAlphanumeric identifier used to identify your whatsApp messages uniquely for reporting purposes.
callbackWebhook URL to notify about the events of the whatsApp message.
idUnique identifier provided by META
textContent of the WhatsApp message sent by the end user.

In case the sent message does not support META, it will display the following message value:

"text": "The message type is not currently supported by META"
userPhone number of the end user.
extraInfoAdditional information sent by the end user from the WhatsApp application.
extraInfo.SAMWELL_WEBHOOK_NAMEWebhook name you typed when setting up the Keyword campaign.
extraInfo.MSGI_SOURCE_CAMPAIGNType of interactive campaign from which the message is received.

- "SKC": Keyword interactive campaign
extraInfo.locationLocation information.
extraInfo.location.longitudeLongitude of the location.
extraInfo.location.latitudeLatitude of the location.
extraInfo.location.nameName of the location.
extraInfo.location.adressAddress of the location.
extraInfo.contactsEnd user information.
extraInfo.contacts.profileEnd user profile
extraInfo.contacts.profile.nameName of the end user.
extraInfo.contacts.wa_idPhone number of the end user.
  • Send the information of a Contact.
{
  "owner": "[email protected]",
  "date": "2023-12-12T18:58:44.819365532Z",
  "processId": 2222,
  "origin": "5500000000",
  "externalId": "[email protected]_111",
  "callback": "https://webhook/111",
  "id": "1122334455",
  "text": "",
  "user": "525511111111",
  "extraInfo": {
    "SAMWELL_WEBHOOK_NAME": "Webhook Orders",
    "MSGI_SOURCE_CAMPAIGN": "SKC",
    "contact": [
      {
        "name": {
          "first_name": "Julian",
          "middle_name": "Doe",
          "last_name": "Miller",
          "formatted_name": ""
        },
        "phones": [
          {
            "phone": "+525533333333",
            "type": "Celular",
            "wa_id": "525533333333"
          }
        ]
      }
    ],
    "contacts": [
      {
        "profile": {
          "name": "Alex Smith"
        },
        "wa_id": "525511111111"
      }
    ]
  }
}
ParameterDescription
ownerInteractive Campaign owner.
dateDate when the API receives the WhatsApp message status.

The date is represented with date in UTC Zulu format: (yyyy-mm-dd-Thh:mm:ss.ssZ).
processIdUnique identifier of the process (event).
originPhone number used to originate and send the whatsApp message.
externalIdAlphanumeric identifier used to identify your whatsApp messages uniquely for reporting purposes.
callbackWebhook URL to notify about the events of the whatsApp message.
idUnique identifier provided by META
textContent of the WhatsApp message sent by the end user.

In case the sent message does not support META, it will display the following message value:

"text": "The message type is not currently supported by META"
userPhone number of the end user.
extraInfoAdditional information sent by the end user from the WhatsApp application.
extraInfo.SAMWELL_WEBHOOK_NAMEWebhook name you typed when setting up the Keyword campaign.
extraInfo.MSGI_SOURCE_CAMPAIGNType of interactive campaign from which the message is received.

- "SKC": Keyword interactive campaign
extraInfo.contactContact information.
extraInfo.contact.nameArray containing contact information.
extraInfo.contact.name.first_nameFirst name of the contact.
extraInfo.contact.name.middle_nameMiddle name of the contact.
extraInfo.contact.name.last_nameLast name of the contact.
extraInfo.contact.name.formatted_name
extraInfo.contact.phonesPhone number information of the contact.
extraInfo.contact.phones.phonePhone number of the contact.
extraInfo.contact.phones.typeType of phone number
extraInfo.contact.phones.wa_idPhone number of the contact.
extraInfo.contactsEnd user information.
extraInfo.contacts.profileEnd user profile
extraInfo.contacts.profile.nameName of the end user.
extraInfo.contacts.wa_idPhone number of the end user.