Outgoing text message#
This section describes messageData
object incoming webhook format for outgoing text 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
= textMessage
Configuring an instance
To receive incoming notifications about text messages, you need to enable the settings using one of the following options:
-
Through console enable the settings
Get notifications about messages sent from API
,Get notifications about messages sent from the phone
-
Through the SetSettings method enable the settings
outgoingAPIMessageWebhook
andoutgoingMessageWebhook
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 textMessage |
textMessageData | object | Text message data object |
quotedMessage | object | Quoted message data object. Present only if the message itself is a quote |
textMessageData
object parameters
Parameter | type | Description |
---|---|---|
textMessage | string | Text message |
isTemplateMessage | boolean | The flag indicates whether the message was generated from a template |
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": "F7AEC1B7086ECDC7E6B825",
"senderData": {
"chatId": "79001234567@c.us",
"sender": "79876543210@c.us",
"chatName": "Jane",
"senderName": "John",
"senderContactName": "John Doe"
},
"messageData": {
"typeMessage": "textMessage",
"textMessageData": {
"textMessage": "I use Green-API to send this message to you!"
}
}
}
Text message from group chat webhook body example#
{
"typeWebhook": "outgoingMessageReceived",
"instanceData": {
"idInstance": 7103000000,
"wid": "79876543210@c.us",
"typeInstance": "whatsapp"
},
"timestamp": 1732268220,
"idMessage": "2D9D6721A977D3692465CA",
"senderData": {
"chatId": "120363369140947676@g.us",
"chatName": "Group",
"sender": "79876543210@c.us",
"senderName": "John",
"senderContactName": "John Doe"
},
"messageData": {
"typeMessage": "textMessage",
"textMessageData": {
"textMessage": "I use Green-API to send this message to you!"
}
}
}
Text quoted message webhook body example#
{
"typeWebhook": "outgoingMessageReceived",
"instanceData": {
"idInstance": 7103000000,
"wid": "79876543210@c.us",
"typeInstance": "whatsapp"
},
"timestamp": 1588091580,
"idMessage": "F7AEC1B7086ECDC7E6E4525",
"senderData": {
"chatId": "79001234567@c.us",
"sender": "79876543210@c.us",
"chatName": "Jane",
"senderName": "John",
"senderContactName": "John Doe"
},
"messageData": {
"typeMessage": "quotedMessage",
"extendedTextMessageData": {
"text": "Hi",
"stanzaId": "46618B98B3B9DF50F12789123456",
"participant": "79876543210@c.us"
},
"quotedMessage": {
"stanzaId": "46618B98B3B9DF53456",
"participant": "79876543210@c.us",
"typeMessage": "textMessage",
"textMessage": "Hello"
}
}
}
Image/video/audio/document quote text message body example#
{
"typeWebhook": "outgoingMessageReceived",
"instanceData": {
"idInstance": 7103000000,
"wid": "79876543210@c.us",
"typeInstance": "whatsapp"
},
"timestamp": 1588091580,
"idMessage": "F7AEC1B7086ECDC7E6E45923F5EDB825",
"senderData": {
"chatId": "79001234567@c.us",
"sender": "79876543210@c.us",
"chatName": "Jane",
"senderName": "John",
"senderContactName": "John Doe"
},
"messageData": {
"typeMessage": "quotedMessage",
"extendedTextMessageData": {
"text": "Hi",
"stanzaId": "46618B98B3B9DF50F12345456",
"participant": "79876543210@c.us"
},
"quotedMessage": {
"stanzaId": "46618B98B3B9DF50F123456",
"participant": "79876543210@c.us",
"typeMessage": "imageMessage",
"downloadUrl": "",
"caption": "",
"jpegThumbnail": ""
}
}
}
Contact quote message webhook body example#
{
"typeWebhook": "outgoingMessageReceived",
"instanceData": {
"idInstance": 7103000000,
"wid": "79876543210@c.us",
"typeInstance": "whatsapp"
},
"timestamp": 1588091580,
"idMessage": "F7AEC1B7086ECDC7E6E45923F5EDB825",
"senderData": {
"chatId": "79001234567@c.us",
"sender": "79876543210@c.us",
"chatName": "Jane",
"senderName": "John",
"senderContactName": "John Doe"
},
"messageData": {
"typeMessage": "quotedMessage",
"extendedTextMessageData": {
"text": "Hi",
"stanzaId": "46618B98B3B9DF50F123453456",
"participant": "79876543210@c.us"
},
"quotedMessage": {
"stanzaId": "46618B98B3B9DF50F1239123456",
"participant": "79876543210@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"
}
}
}
}
Location quote message webhook body example#
{
"typeWebhook": "outgoingMessageReceived",
"instanceData": {
"idInstance": 7103000000,
"wid": "79876543210@c.us",
"typeInstance": "whatsapp"
},
"timestamp": 1588091580,
"idMessage": "F7AEC1B7086ECDC7E6E45DB825",
"senderData": {
"chatId": "79001234567@c.us",
"sender": "79876543210@c.us",
"chatName": "Jane",
"senderName": "John",
"senderContactName": "John Doe"
},
"messageData": {
"typeMessage": "quotedMessage",
"extendedTextMessageData": {
"text": "Address",
"stanzaId": "46618B98B3B9DF50F1234523456",
"participant": "79876543210@c.us"
},
"quotedMessage": {
"stanzaId": "46618B98B3B9DF50F123123456",
"participant": "79876543210@c.us",
"typeMessage": "locationMessage",
"location": {
"nameLocation": "",
"address": "",
"jpegThumbnail": "",
"latitude": 72.5922702,
"longitude": 39.6645388
}
}
}
}
Link quote message webhook body example#
{
"typeWebhook": "outgoingMessageReceived",
"instanceData": {
"idInstance": 7103000000,
"wid": "79876543210@c.us",
"typeInstance": "whatsapp"
},
"timestamp": 1658261933,
"idMessage": "CDF9219DD08D3D84FBFFD",
"senderData": {
"chatId": "70123456789@c.us",
"sender": "79876543210@c.us",
"chatName": "Jane",
"senderName": "John",
"senderContactName": "John Doe"
},
"messageData": {
"typeMessage": "quotedMessage",
"extendedTextMessageData": {
"text": "Hello",
"stanzaId": "46618B98B3B9DF50F89123456",
"participant": "79876543210@c.us"
},
"quotedMessage": {
"stanzaId": "46618B98B3B9DF556789123456",
"participant": "79876543210@c.us",
"typeMessage": "extendedTextMessage",
"textMessage": "https://api.greenapi.com/send/?phone=7000000000&text&type=phone_number&app_absent=0",
"extendedTextMessage": {
"description": " is free and offers simple, secure, reliable messaging and calling, available on phones all over the world.",
"title": "Share on ",
"previewType": "None",
"jpegThumbnail": null
}
}
}
}