Skip to content
Download Beeper

Add a reaction

$client->chats->messages->reactions->add(string messageID, string chatID, string reactionKey, ?string transactionID): ReactionAddResponse
POST/v1/chats/{chatID}/messages/{messageID}/reactions

Add a reaction to an existing message.

ParametersExpand Collapse
chatID: string

Chat ID. Input routes also accept the local chat ID from this installation when available.

messageID: string

Message ID.

reactionKey: string

Reaction key to add (emoji, shortcode, or custom emoji key)

transactionID?:optional string

Optional transaction ID for deduplication and send tracking

ReturnsExpand Collapse
string chatID

Chat ID. Input routes also accept the local chat ID from this installation when available.

string messageID

Message ID.

string reactionKey

Reaction key that was added.

true success

Always true. Indicates the reaction was queued; failures return an error response.

string transactionID

Transaction ID used for send tracking.

Add a reaction

<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

$client = new Client(accessToken: 'My Access Token');

$response = $client->chats->messages->reactions->add(
  '1343993',
  chatID: '!NCdzlIaMjZUmvmvyHU:beeper.com',
  reactionKey: 'x',
  transactionID: 'transactionID',
);

var_dump($response);
{
  "chatID": "!whatsapp_15550101002:ba_EvYDBBsZbRQAy3UOSWqG0LuTVkc.local-whatsapp.localhost",
  "messageID": "1343993",
  "reactionKey": "❤️",
  "success": true,
  "transactionID": "txn_v3a8f4c9d2e1"
}
Returns Examples
{
  "chatID": "!whatsapp_15550101002:ba_EvYDBBsZbRQAy3UOSWqG0LuTVkc.local-whatsapp.localhost",
  "messageID": "1343993",
  "reactionKey": "❤️",
  "success": true,
  "transactionID": "txn_v3a8f4c9d2e1"
}