Skip to content

SendReaction#

Test Postman Apidog

ื”ืฉื™ื˜ื” ื ื•ืขื“ื” ืœืฉืœื™ื—ืช ืชื’ื•ื‘ื” ืœื”ื•ื“ืขื” ื‘ืฆืณืื˜.

ื‘ืงืฉื”#

ื›ื“ื™ ืœืฉืœื•ื— ืชื’ื•ื‘ื” ืœื”ื•ื“ืขื”, ื™ืฉ ืœื‘ืฆืข ื‘ืงืฉื” ืœื›ืชื•ื‘ืช:

POST
{{apiUrl}}/waInstance{{idInstance}}/sendReaction/{{apiTokenInstance}}

ืœืงื‘ืœืช ืคืจืžื˜ืจื™ ื”ื‘ืงืฉื” apiUrl, idInstance ื•-apiTokenInstance ืขื™ื™ื ื• ื‘ื—ืœืง ืœืคื ื™ ืชื—ื™ืœืช ื”ืขื‘ื•ื“ื”.

ืคืจืžื˜ืจื™ ื‘ืงืฉื”#

ืคืจืžื˜ืจ ืกื•ื’ ื—ื•ื‘ื” ืชื™ืื•ืจ
chatId string ื›ืŸ ืžื–ื”ื” ืฆืณืื˜
idMessage string ื›ืŸ ืžื–ื”ื” ื”ื”ื•ื“ืขื” ืฉืขืœื™ื” ืชื•ื’ื‘ ื”ืชื’ื•ื‘ื”
reaction string ื›ืŸ ืชื’ื•ื‘ื” ื‘ืคื•ืจืžื˜ ืกื™ืžื ื™ emoji ืื• ื‘ืคื•ืจืžื˜ ื™ื•ื ื™ืงื•ื“ (ืœื“ื•ื’ืžื” "\uD83D\uDC4F") .ืงืจืื• ืขื•ื“ ื‘ืฉืืœื•ืช ื”ื ืคื•ืฆื•ืช ืฉืœื ื•

ื“ื•ื’ืžื” ืœื’ื•ืฃ ื”ื‘ืงืฉื”#

ืชื’ื•ื‘ื” ื‘ืคื•ืจืžื˜ ืกื™ืžื ื™ emoji

{
    "chatId": "79876543210@c.us",
    "idMessage": "BAE550673B9C0497",
    "reaction": "โค๏ธ"
}

ืชื’ื•ื‘ื” ื‘ืคื•ืจืžื˜ ื™ื•ื ื™ืงื•ื“

{
    "chatId": "79876543210@c.us",
    "idMessage": "BAE550673B9C0497",
    "reaction": "\\uD83D\\uDC4F"
}

ืชื’ื•ื‘ื”#

ืฉื“ื•ืช ื”ืชื’ื•ื‘ื”#

ืฉื“ื” ืกื•ื’ ืชื™ืื•ืจ
idMessage string ืžื–ื”ื” ื”ื”ื•ื“ืขื” ืฉื ืฉืœื—ื”

ื“ื•ื’ืžื” ืœื’ื•ืฃ ื”ืชื’ื•ื‘ื”#

{
    "idMessage": "BAE550673B9C0497"
}

ืฉื’ื™ืื•ืช SendReaction#

ืืช ืจืฉื™ืžืช ื”ืฉื’ื™ืื•ืช ื”ืžืฉื•ืชืคื•ืช ืœื›ืœ ื”ืฉื™ื˜ื•ืช ืจืื• ื‘ื—ืœืง ืฉื’ื™ืื•ืช ืกื˜ื ื“ืจื˜ื™ื•ืช

ื“ื•ื’ืžืื•ืช ืงื•ื“#

import requests

url = "{{apiUrl}}/waInstance{{idInstance}}/sendReaction/{{apiTokenInstance}}"

payload = {
    "chatId": "10000000",
    "idMessage": "BAE550673B9C0497",
    "reaction": "\\uD83D\\uDC4F"
}
headers = {
'Content-Type': 'application/json'
}

response = requests.post(url, json=payload, headers=headers)

print(response.text.encode('utf8'))
<?php
//The apiUrl, idInstance and apiTokenInstance values are available in console, double brackets must be removed
$url = '{{apiUrl}}/waInstance{{idInstance}}/sendReaction/{{apiTokenInstance}}';

//chatId is the number to send the message to (@c.us for private chats, @g.us for group chats)
$data = array(
    'chatId' => '10000000',
    'idMessage' => 'BAE550673B9C0497',
    'reaction' => '\\uD83D\\uDC4F'
);

$options = array(
    'http' => array(
        'header' => "Content-Type: application/json\r\n",
        'method' => 'POST',
        'content' => json_encode($data)
    )
);

$context = stream_context_create($options);

$response = file_get_contents($url, false, $context);

echo $response;
?>
curl --location '{{apiUrl}}/waInstance{{idInstance}}/sendReaction/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "chatId": "10000000",
    "idMessage": "BAE550673B9C0497",
    "reaction": "\\uD83D\\uDC4F"
}'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
    .append({{apiUrl}})
    .append("/waInstance").append({{idInstance}})
    .append("/sendReaction/")
    .append({{apiTokenInstance}});

var headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);

var jsonBody = "{\r\n\t\"chatId\": \"79876543210@c.us\",\r\n\t\"idMessage\": \"BAE550673B9C0497\",\r\n\t\"reaction\": \"\\uD83D\\uDC4F\"}";

var requestEntity = new HttpEntity<>(jsonBody, headers);

var response = restTemplate.exchange(requestUrl.toString(), HttpMethod.POST, requestEntity, String.class);
System.out.println(response);
var requestUrl = new StringBuilder();
requestUrl
    .append({{apiUrl}})
    .append("/waInstance").append({{idInstance}})
    .append("/sendReaction/")
    .append({{apiTokenInstance}});

var response = Unirest.post(requestUrl.toString())
    .header("Content-Type", "application/json")
    .body("{\r\n\t\"chatId\": \"79876543210@c.us\",\r\n\t\"idMessage\": \"BAE550673B9C0497\",\r\n\t\"reaction\": \"\\uD83D\\uDC4F\"}")
    .asString();

System.out.println(response);
Sub SendReaction()
Dim URL As String
Dim RequestBody As String
Dim http As Object

' The apiUrl, idInstance and apiTokenInstance values are available in console, double brackets must be removed
URL = "{{apiUrl}}/waInstance{{idInstance}}/sendReaction/{{apiTokenInstance}}"

' chatId is the number to send the message to (@c.us for private chats, - for group chats)
RequestBody = "{""chatId"":""79876543210@c.us"",""idMessage"":""BAE550673B9C0497"", ""reaction"":""\\uD83D\\uDC4F""}"

Set http = CreateObject("MSXML2.XMLHTTP")

With http
    .Open "POST", URL, False
    .setRequestHeader "Content-Type", "application/json"
    .send RequestBody
End With

Set http = Nothing

End Sub
program sendReaction;

{$APPTYPE CONSOLE}

uses
System.SysUtils,
System.Classes, System.Net.HttpClient, System.Net.URLClient, System.Net.HttpClientComponent;

var
HttpClient: TNetHTTPClient;
RequestBody: TStringStream;
RequestHeaders: TNetHeaders;
Response: IHTTPResponse;
EndpointURL, ID_INSTANCE, API_TOKEN_INSTANCE: string;

begin
ID_INSTANCE := '110100001';
API_TOKEN_INSTANCE := 'd75b3a66374942c5b3c019c698abc2067e151558acbd451234';

EndpointURL := 'https://api.green-api.com/waInstance' + ID_INSTANCE + '/sendReaction/' + API_TOKEN_INSTANCE;

HttpClient := TNetHTTPClient.Create(nil);
RequestBody := TStringStream.Create('{ "chatId":"79876543210@c.us","idMessage":"BAE550673B9C0497", "reaction":"\\uD83D\\uDC4F"}', TEncoding.UTF8);
RequestHeaders := [
    TNetHeader.Create('Content-Type', 'application/json')
];

try
    Response := HTTPClient.Post(EndpointURL, RequestBody, nil, RequestHeaders);

    if Response.StatusCode = 200 then
    Writeln('[Response]: ' + Response.ContentAsString)
    else
    Writeln('[ERROR ' + IntToStr(Response.StatusCode) + ']:' + Response.StatusText + '' + Response.ContentAsString);

    readln;
except
    on E: Exception do
    Writeln(E.ClassName, ': ', E.Message);
end;

HttpClient.Free;
RequestBody.Free;

end.