Group invitation incoming message#
This section describes messageData
object incoming webhook format for group invitation incoming 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
= groupInviteMessage
Conditions required for receiving groupInviteMessage
notification
To receive incoming notifications about invitations to a group, you need to enable the settings using one of the following options:
- Through console enable the
Get notifications about incoming messages and files
settings - Through the SetSettings method enable the
incomingWebhook
settings
Conditions for receiving a groupInviteMessage type notification: - the sender's phone number is saved in the recipient's contacts; - the recipient's phone number is not saved by the sender in contacts; - in the recipient's privacy settings, the ability to send invitations to the group is configured only for contacts.
To send an invitation to a new group:
- Create a group in WhatsApp with participant's number
- You'll get the notification "Couldn't add <...>. You can invite them privately to join this group"
- Select "Invite to group".
To send an invitation to an existing group:
- Go to an existing group, open “group info, select “add members”, select your recipient
- You'll get the notification "Couldn't add <...>. You can invite them privately to join this group"
- Select "Invite to group".
After that, the recipient will receive an invitation to the group and a groupInviteMessage
notification on the linked Instance.
Group invitation links are not messages with type
groupInviteMessage
.Receiving this type of notification is only possible by sending an invitation through the device. Sending this invitation via API is not possible.
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: groupInviteMessage |
groupInviteMessageData | object | Incoming group invitation message data object |
quotedMessage | object | Quoted message data object. |
groupInviteMessageData
object parameters
Parameter | Type | Description |
---|---|---|
groupJid | string | Group chatId |
inviteCode | string | Invitation code |
inviteExpiration | string | Invitation expiration |
groupName | string | Group name |
caption | string | Message caption |
name | string | Sender's name |
jpegThumbnail | string | Image preview in base64 |
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",
"chatName": "John",
"sender": "79001234568@c.us",
"senderName": "John",
"senderContactName": "John Doe"
},
"messageData": {
"typeMessage": "groupInviteMessage",
"groupInviteMessageData": {
"groupJid": "79099197688-1506012221@g.us",
"inviteCode": "a7E5WU/g7rmjaQnv",
"inviteExpiration": "0",
"groupName": "Makhlovka, drawing 4-6",
"caption": "Invitation to my WhatsApp group",
"name": "myname",
"jpegThumbnail": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQY/9k="
}
}
}