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

Parameter

Description

owner

Interactive Campaign owner.

date

Date 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).

processId

Unique identifier of the process (event).

origin

Phone number used to originate and send the whatsApp message.

externalId

Alphanumeric identifier used to identify your whatsApp messages uniquely for reporting purposes.

callback

Webhook URL to notify about the events of the whatsApp message.

id

Unique identifier provided by META

text

Content 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"

user

Phone number of the end user.

extraInfo

Additional information sent by the end user from the WhatsApp application.

extraInfo.SAMWELL_WEBHOOK_NAME

Webhook name you typed when setting up the Keyword campaign.

extraInfo.MSGI_SOURCE_CAMPAIGN

Type of interactive campaign from which the message is received.

  • "SKC": Keyword interactive campaign

extraInfo.contacts

End user information.

extraInfo.contacts.profile

End user profile

extraInfo.contacts.profile.name

Name of the end user.

extraInfo.contacts.wa_id

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

Parameter

Description

owner

Interactive Campaign owner.

date

Date 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).

processId

Unique identifier of the process (event).

origin

Phone number used to originate and send the whatsApp message.

externalId

Alphanumeric identifier used to identify your whatsApp messages uniquely for reporting purposes.

callback

Webhook URL to notify about the events of the whatsApp message.

id

Unique identifier provided by META

text

Content 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"

user

Phone number of the end user.

extraInfo

Additional information sent by the end user from the WhatsApp application.

extraInfo.SAMWELL_WEBHOOK_NAME

Webhook name you typed when setting up the Keyword campaign.

extraInfo.MSGI_SOURCE_CAMPAIGN

Type of interactive campaign from which the message is received.

  • "SKC": Keyword interactive campaign

extraInfo.sticker

Sticker information

extraInfo.sticker.fileName

Name of the sticker

extraInfo.sticker.shaData

Optional.

Verify if the sticker is secure according to Secure Hash Algorithms (SHA).

extraInfo.sticker.url

URL of a sticker sent in a WhatsApp message.

extraInfo.contacts

End user information.

extraInfo.contacts.profile

End user profile

extraInfo.contacts.profile.name

Name of the end user.

extraInfo.contacts.wa_id

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

Parameter

Description

owner

Interactive Campaign owner.

date

Date 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).

processId

Unique identifier of the process (event).

origin

Phone number used to originate and send the whatsApp message.

externalId

Alphanumeric identifier used to identify your whatsApp messages uniquely for reporting purposes.

callback

Webhook URL to notify about the events of the whatsApp message.

id

Unique identifier provided by META

text

Content 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"

user

Phone number of the end user.

extraInfo

Additional information sent by the end user from the WhatsApp application.

extraInfo.SAMWELL_WEBHOOK_NAME

Webhook name you typed when setting up the Keyword campaign.

extraInfo.MSGI_SOURCE_CAMPAIGN

Type of interactive campaign from which the message is received.

  • "SKC": Keyword interactive campaign

extraInfo.attachments

Attachment files information.

extraInfo.attachments.fileName

File name and type.

extraInfo.attachments.shaData

Optional.

Verify if the file is secure according to Secure Hash Algorithms (SHA).

extraInfo.attachments.url

URL of the image or pdf file sent in a WhatsApp message.

extraInfo.contacts

End user information.

extraInfo.contacts.profile

End user profile

extraInfo.contacts.profile.name

Name of the end user.

extraInfo.contacts.wa_id

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

Parameter

Description

owner

Interactive Campaign owner.

date

Date 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).

processId

Unique identifier of the process (event).

origin

Phone number used to originate and send the whatsApp message.

externalId

Alphanumeric identifier used to identify your whatsApp messages uniquely for reporting purposes.

callback

Webhook URL to notify about the events of the whatsApp message.

id

Unique identifier provided by META

text

Content 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"

user

Phone number of the end user.

extraInfo

Additional information sent by the end user from the WhatsApp application.

extraInfo.SAMWELL_WEBHOOK_NAME

Webhook name you typed when setting up the Keyword campaign.

extraInfo.MSGI_SOURCE_CAMPAIGN

Type of interactive campaign from which the message is received.

  • "SKC": Keyword interactive campaign

extraInfo.location

Location information.

extraInfo.location.longitude

Longitude of the location.

extraInfo.location.latitude

Latitude of the location.

extraInfo.location.name

Name of the location.

extraInfo.location.adress

Address of the location.

extraInfo.contacts

End user information.

extraInfo.contacts.profile

End user profile

extraInfo.contacts.profile.name

Name of the end user.

extraInfo.contacts.wa_id

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

Parameter

Description

owner

Interactive Campaign owner.

date

Date 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).

processId

Unique identifier of the process (event).

origin

Phone number used to originate and send the whatsApp message.

externalId

Alphanumeric identifier used to identify your whatsApp messages uniquely for reporting purposes.

callback

Webhook URL to notify about the events of the whatsApp message.

id

Unique identifier provided by META

text

Content 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"

user

Phone number of the end user.

extraInfo

Additional information sent by the end user from the WhatsApp application.

extraInfo.SAMWELL_WEBHOOK_NAME

Webhook name you typed when setting up the Keyword campaign.

extraInfo.MSGI_SOURCE_CAMPAIGN

Type of interactive campaign from which the message is received.

  • "SKC": Keyword interactive campaign

extraInfo.contact

Contact information.

extraInfo.contact.name

Array containing contact information.

extraInfo.contact.name.first_name

First name of the contact.

extraInfo.contact.name.middle_name

Middle name of the contact.

extraInfo.contact.name.last_name

Last name of the contact.

extraInfo.contact.name.formatted_name

extraInfo.contact.phones

Phone number information of the contact.

extraInfo.contact.phones.phone

Phone number of the contact.

extraInfo.contact.phones.type

Type of phone number

extraInfo.contact.phones.wa_id

Phone number of the contact.

extraInfo.contacts

End user information.

extraInfo.contacts.profile

End user profile

extraInfo.contacts.profile.name

Name of the end user.

extraInfo.contacts.wa_id

Phone number of the end user.