[go: up one dir, main page]

Skip to content

Incoming text message or URL message#

This section describes messageData object incoming webhook format for incoming text message with URL. 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 = extendedTextMessage

Configuring an instance

To receive incoming notifications about extended text 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 Incoming message type. For messages of this type, the parameter takes on the value extendedTextMessage
extendedTextMessageData object Data object on incoming link with meta-data
quotedMessage object Quoted message data object. Present only if the message itself is a quote

extendedTextMessageData object parameters

Parameter Type Description
text string Link text or ordinary text
description string Link description, may be empty
title string Link title, may be empty
containsAutoReply boolean Whether the message contains an auto reply (only for advertisement messages)
mediaType string Message media type, for example "IMAGE" (only for advertisement messages)
showAdAttribution boolean Whether the advertisement details should be shown (only for advertisement messages)
sourceId string Advertisement Id (only for advertisement messages)
sourceType string Source type, for example "ad" (only for advertisement messages)
sourceUrl string Advertisement url (only for advertisement messages)
conversionSource string Message localization (only for advertising messages)
entryPointConversionApp string Message source ( only for advertising messages)
jpegThumbnail string base64-coded image preview, may be absent
thumbnailUrl string Image preview url (only for advertisement messages)
isForwarded boolean Whether the message is forwarded, takes on values true/false
forwardingScore integer Number of message forwards
previewType string Preview type (only for advertisement messages) previewType:None value is deprecated

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": "extendedTextMessage",
        "extendedTextMessageData": {
            "text": "https://green-api.com/docs/video",
            "description": "Green API docs show how you can develop the WhatsApp Bot",
            "title": "How to develop WhatsApp Bot",
            "jpegThumbnail": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYG==",
            "forwardingScore": 4,
            "isForwarded": true
        }
    }
}

Link or text and contact 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",
    "senderName": "John",
    "senderContactName": "John Doe"
  },
  "messageData": {
    "typeMessage": "quotedMessage",
    "extendedTextMessageData": {
      "text": "https://yandex.ru/former&utm_source=home&utm_content=main_informer&utm_term=main_number",
      "stanzaId": "0EA554E587820E35309858AE265BE7EA",
      "participant": "79001230000@c.us",
      "forwardingScore": 4,
      "isForwarded": true
    },
    "quotedMessage": {
      "stanzaId": "9A73322488DCB7D9689A6112F2528C9D",
      "participant": "79061230000@c.us",
      "typeMessage": "contactMessage",
      "contact": {
        "displayName": "Green-Api",
        "vcard": "BEGIN:VCARD\nVERSION:3.0\nN:Green-Api\nitem1.TEL;waid=79001230000\nitem1.X-ABLabel:Mobile\nEND:VCARD"
      }
    }
  }
}

Link and image 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",
    "senderName": "John",
    "senderContactName": "John Doe"
  },
  "messageData": {
    "typeMessage": "quotedMessage",
    "extendedTextMessageData": {
      "text": "https://yandex.ru/pogoda/?utm_medium=source=home&utm_content=main_informer&utm_term=main_number",
      "stanzaId": "B4AA239D112CB2576897B3910FEDE26E",
      "participant": "79001230000@c.us",
      "forwardingScore": 4,
      "isForwarded": true
    },
    "quotedMessage": {
      "stanzaId": "9A73322488DCB7D9689A6112F2528C9D",
      "participant": "79061230000@c.us",
      "typeMessage": "imageMessage",
      "downloadUrl": "",
      "caption": "",
      "jpegThumbnail": ""
    }
  }
}

Advertising 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",
        "chatName": "John",
        "sender": "79001234568@c.us",
        "senderName": "John",
        "senderContactName": "John Doe"
    },
    "messageData": {
        "typeMessage": "extendedTextMessage",
        "extendedTextMessageData": {
            "text": "https://fb.me/gUdvBdhtH",
            "description": "Новый инстанс для вашего бизнеса!",
            "title": "Green API",
            "containsAutoReply": false,
            "mediaType": "IMAGE",
            "showAdAttribution": false,
            "sourceId": "122210486228016873",
            "sourceType": "post",
            "sourceUrl": "https://fb.me/gUdvBdhtH",
            "conversionSource": "FB_Ads",
            "entryPointConversionApp": "instagram",
            "jpegThumbnail": "/9j/4AAQSkZJRgABAQAAAQABAAD/7QCEUGhvdG9zaG9wIDMuMAA4qIJUeuMEjYwGc9BtFMXTYvgsnm4ADy6HLLZDqn1Ye5RMev+ae1hED2B9dQIARwjvDIwYCg4/r/9k=",
            "thumbnailUrl": "https://scontent.xx.fbcdn.net/v/t39.30808-6/436945887_122115998378256688_307643393252141869_n.jpg?stp=dst-jpg_s851x315&_nc_cat=111&ccb=1-7&_nc_sid=5f2048&_nc_ohc=x61r6W-VrJIAb69T4Dl&_nc_ad=z-m&_nc_cid=0&_nc_ht=scontent.xx&oh=00_AfDLFkjNOBYEntBu6SYaUOxDuxbvarjKha9Ez5RQUXjsfg&oe=662D7680",
            "previewType": ""
            }
    }
}