SendReaction#
Beta version
The functionality is in beta. Features may change and may also work unstably.
The method sets or removes a reaction on a message in an Instagram Direct chat.
To remove a reaction, pass an empty string in the reaction field.
The method uses the limits on the number of requests per second.
Request#
To send a reaction, you have to execute a request at:
POST
{{apiUrl}}/waInstance{{idInstance}}/sendReaction/{{apiTokenInstance}}
For apiUrl, idInstance and apiTokenInstance request parameters, refer to the Before you start section.
Request parameters#
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
chatId | string | Yes | Chat identifier - the numeric identifier of an account or of a group chat, or a username with the @ prefix |
idMessage | string | No* | The identifier of the message the reaction is set on |
messageId | string | No* | The deprecated name of the idMessage field. It is accepted for backward compatibility |
reaction | string | No | The emoji of the reaction - as a character or as an escaped notation, for example "\\uD83D\\uDC4F". An empty value and null remove the reaction. The default is an empty string |
The message is specified by the
idMessagefield or by the deprecatedmessageIdfield - one of them is mandatory.
Request body example#
Set a reaction:
{
"chatId": "49547665464",
"idMessage": "32992354783594572492903878028689408",
"reaction": "❤️"
}
Remove a reaction:
{
"chatId": "49547665464",
"idMessage": "32992354783594572492903878028689408",
"reaction": ""
}
Response#
Response parameters#
| Field | Type | Description |
|---|---|---|
idMessage | string | The reaction identifier. Assigned by the system; the same identifier arrives in the reaction notification and in the journal |
Response body example#
{
"idMessage": "32992354783594572492903952886663467"
}
SendReaction errors#
For a list of errors common to all methods, refer to the Common errors section
| HTTP code | Error ID | Description |
|---|---|---|
| 400 | Bad Request Validation failed | Validation error |
| 400 | Validation failed. Details: 'value' must contain at least one of [idMessage, messageId] | The message identifier is not passed |
| 400 | Validation failed. Details: 'reaction' must be a single emoji (UTF-8) or an empty string to remove the reaction | The reaction field does not hold a single emoji: letters, two emoji or a corrupted encoding |
| 400 | request rejected | Instagram has rejected the reaction - for example, reactions are not available in this chat |
| 400 | message '32992354783594572492903878028689408' not found | The instance is authorized through a browser session: there is no such message in the chat |
| 504 | Instagram did not answer | The reaction has not been set: Instagram has not confirmed its delivery. The request can be repeated |
Request examples#
import requests
url = "{{apiUrl}}/waInstance{{idInstance}}/sendReaction/{{apiTokenInstance}}"
payload = {
"chatId": "49547665464",
"idMessage": "32992354783594572492903878028689408",
"reaction": "❤️"
}
headers = {'Content-Type': 'application/json'}
response = requests.post(url, json=payload, headers=headers)
print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/sendReaction/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"chatId": "49547665464",
"idMessage": "32992354783594572492903878028689408",
"reaction": "❤️"
}'