Sent message with a contact#
This section describes the format of the incoming notification messageData object for a sent message with a contact. For a description of the general format of incoming notifications, refer to the Sent message section.
To receive incoming notifications of this kind, two conditions must be met:
typeWebhook=outgoingMessageReceived||outgoingAPIMessageReceivedmessageData.typeMessage=contactMessage
Instance settings
To receive incoming notifications about sent messages, you need to enable the settings in one of the ways presented:
-
Through the console, enable the
Receive notifications about messages sent from the phoneandReceive notifications about messages sent through the APIsettings (additionallyReceive notifications about the statuses of sent messagesto receive notifications about the statuses of a sent message) -
Through the SetSettings method, enable the
outgoingMessageWebhookandoutgoingAPIMessageWebhooksettings (additionallyoutgoingWebhookto receive notifications about the statuses of a sent message)
Notification#
Notification format#
Fields of the messageData object
| Parameter | Type | Description |
|---|---|---|
typeMessage | string | Type of the received message. For messages of this type the field takes the value contactMessage |
contactMessageData | object | Object with data about the received contact. |
Fields of the contactMessageData object
| Parameter | Type | Description |
|---|---|---|
phoneContact | string | Contact's number |
firstName | string | Contact's first name |
lastName | string | Contact's last name |
vcard | string | Additional data |
chatId | string | Chat identifier |
forwardingScore | integer | Number of times the message has been forwarded |
isForwarded | boolean | Flag of a forwarded message true/false |
Notification body example#
Example of a notification body for a sent message with a contact#
{
"typeWebhook": "outgoingMessageReceived",
"instanceData": {
"idInstance": 4100000000,
"wid": "79876543210@c.us",
"typeInstance": "telegram"
},
"timestamp": 1763115112,
"idMessage": "1763115112345",
"senderData": {
"chatId": "10000000",
"chatType": "user",
"sender": "10000000",
"chatName": "Vasilisa the Wise",
"senderName": "Vasilisa the Wise",
"senderType": "user",
"senderContactName": "Vasilisa the Wise",
"senderPhoneNumber": 79876543210
},
"messageData": {
"typeMessage": "contactMessage",
"contactMessageData": {
"chatId": "10000000",
"phoneNumber": 79991112233,
"displayName": "Vasilisa the Wise",
"vcard": "",
"forwardingScore": 0,
"isForwarded": false
}
}
}
Example of a notification body for a message with a contact sent to a group chat#
{
"typeWebhook": "outgoingMessageReceived",
"instanceData": {
"idInstance": 4100000000,
"wid": "79876543210@c.us",
"typeInstance": "telegram"
},
"timestamp": 1763115112,
"idMessage": "1763468266381",
"senderData": {
"chatId": "-10000000000000",
"chatType": "supergroup",
"sender": "10000000",
"chatName": "Faraway Kingdom",
"senderName": "Vasilisa",
"senderType": "user",
"senderContactName": "",
"senderPhoneNumber": 0
},
"messageData": {
"typeMessage": "contactMessage",
"contactMessageData": {
"chatId": "10000000",
"urlAvatar": "https://i.oneme.ru/i?r=BTE2sh_eZW7g8kugOdIm2NotBPGJiDHPpKQP3fE_vh2BE1holGE_adbUwUqCIPQgiOI",
"phoneNumber": 79991112233,
"displayName": "Vasilisa the Wise",
"vcard": "",
"forwardingScore": 0,
"isForwarded": false
}
}
}