[go: up one dir, main page]

Skip to content

Incoming location message#

This section describes messageData object incoming webhook format for incoming location message. For a description of the general format of incoming webhooks, refer to Incoming messages section.

To get incoming webhooks of this type, two conditions must be true:

typeWebhook = incomingMessageReceived

messageData.typeMessage = locationMessage

Configuring an instance

To receive incoming notifications about location messages, you need to enable the settings using one of the following options:

  1. Through console enable the setting Get notifications about incoming messages and files

  2. Through the SetSettings method enable the setting incomingWebhook

Webhook#

Webhook parameters#

messageData object parameters

Parameter Type Description
typeMessage string Received message type. For messages of this type, the parameter takes on the value locationMessage
locationMessageData object Received location data object
quotedMessage object Quoted message data object. Present only if the message itself is a quote

locationMessageData object parameters

Parameter Type Description
nameLocation string Name of the location
address string Address of the location
jpegThumbnail string Preview of the image in base64 encoding
latitude double Location latitude
longitude double Location longitude
forwardingScore integer Number of message forwards
isForwarded boolean Whether the message is forwarded, takes on values true/false

quotedMessage object parameters

Parameter Type Description
stanzaId string Quoted message id
participant string Quoted message sender's id
typeMessage string Quoted message type

The rest of the fields are filled depending on the type of the quoted message and are identical to the fields of incoming messages described in Incoming messages section

Webhook body example#

{
  "typeWebhook": "incomingMessageReceived",
  "instanceData": {
    "idInstance": 1234,
    "wid": "11001234567@c.us",
    "typeInstance": "whatsapp"
  },
  "timestamp": 1588091580,
  "idMessage": "F7AEC1B7086ECDC7E6E45923F5EDB825",
  "senderData": {
    "chatId": "79001234568@c.us",
    "sender": "79001234568@c.us",
    "chatName": "John",
    "senderName": "John",
    "senderContactName": "John Doe"
  },
  "messageData": {
    "typeMessage": "locationMessage",
    "locationMessageData": {
      "nameLocation": "Empire State Building",  
      "address": "20 W 34th St., New York, NY 10001, US",
      "jpegThumbnail": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFx=",
      "latitude": 12.345678910111213,
      "longitude": 14.151617181920212,
      "forwardingScore": 0,
      "isForwarded": false
    }
  }
}

Location and text quote incoming message webhook body example#

{
  "typeWebhook": "incomingMessageReceived",
  "instanceData": {
    "idInstance": 1234,
    "wid": "11001234567@c.us",
    "typeInstance": "whatsapp"
  },
  "timestamp": 1588091580,
  "idMessage": "F7AEC1B7086ECDC7E6E45923F5EDB825",
  "senderData": {
    "chatId": "79001234568@c.us",
    "sender": "79001234568@c.us",
    "chatName": "John",
    "senderName": "John",
    "senderContactName": "John Doe"
  },
  "messageData": {
    "typeMessage": "locationMessage",
    "locationMessageData": {
      "nameLocation": "Empire State Building",
      "address": "20 W 34th St., New York, NY 10001, US",
      "jpegThumbnail": "217",
      "latitude": 74.5922641,
      "longitude": 59.6645355,
      "forwardingScore": 4,
      "isForwarded": true
    },
    "quotedMessage": {
      "stanzaId": "9A73322488DCB7D9689A6112F2528C9D",
      "participant": "79001230022@c.us",
      "typeMessage": "textMessage",
      "textMessage": "Hello"
    }
  }
}