Skip to content

Outgoing location message#

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

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

typeWebhook = outgoingMessageReceived || outgoingAPIMessageReceived

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 settings Get notifications about messages sent from API, Get notifications about messages sent from the phone

  2. Through the SetSettings method enable the settings outgoingAPIMessageWebhook and outgoingMessageWebhook

Webhook#

Webhook parameters#

messageData object parameters

Parameter Type Description
typeMessage string incoming webhook type. For messages of this type, the parameter takes on the value locationMessage
locationMessageData object Outgoing 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 outgoing messages described in Outgoing messages section

Webhook body example#

{
  "typeWebhook": "outgoingMessageReceived",
  "instanceData": {
    "idInstance": 7103000000,
    "wid": "79876543210@c.us",
    "typeInstance": "whatsapp"
  },
  "timestamp": 1588091580,
  "idMessage": "F7AEC1B7086ECDC7EB825",
  "senderData": {
    "chatId": "79001234567@c.us",
    "sender": "79876543210@c.us",
    "chatName": "Jane",
    "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 message from group chat webhook body example#

{
    "typeWebhook": "outgoingMessageReceived",
    "instanceData": {
        "idInstance": 7103000000,
        "wid": "79876543210@c.us",
        "typeInstance": "whatsapp"
    },
    "timestamp": 1732268220,
    "idMessage": "2D9D6721A977D369E0CE44CA",
    "senderData": {
      "chatId": "120363369140947676@g.us",
      "chatName": "Group",
      "sender": "79876543210@c.us",
      "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 outgoing message webhook body example#

{
  "typeWebhook": "outgoingMessageReceived",
  "instanceData": {
    "idInstance": 7103000000,
    "wid": "79876543210@c.us",
    "typeInstance": "whatsapp"
  },
  "timestamp": 1588091580,
  "idMessage": "F7AEC1B7086ECDC7E6EB825",
  "senderData": {
    "chatId": "79001234567@c.us",
    "sender": "79876543210@c.us",
    "chatName": "Jane",
    "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": "79876543210@c.us",
      "typeMessage": "textMessage",
      "textMessage": "Hello"
    }
  }
}