Search code examples
phpwhatsappclickatell

Clickatel reply to a particular message


I am trying to send a message as a reply to a previous message using clickatel api.

Below is my payload

        $header = [
            "Content-Type: application/json",
            "Accept: application/json",
            "Authorization: " . $clickatel_api_key
        ];
        $message = [
            'channel' => 'whatsapp',
            'to' => formatPhone($contact->phone),
            'content' => $text,
            'relatedMessageId' => $message->message_id
        ];

        $messages = [];
        array_push($messages, $message);

        $data['messages'] = $messages;

        $link = 'https://platform.clickatell.com/v1/message';
        $ch = curl_init($link);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
        $response = curl_exec($ch);
        curl_close($ch);

I have tried to change the relatedMessageId key to clientEventId and relatedClientMessageId and none worked.

It is just sending the message without sending it as a reply to a specific question


Solution

  • This is not supported by 'Whatsapp Business Platform' as its not in their documentation currently, so also not supported by Clickatell or anyone else.

    The field you are using 'relatedMessageId' does not apply to sending a message currently - it's only relevant to receiving a message.