Why message will not be sent؟

Home / Uncategorized / Why message will not be sent؟

webhook is set…

I want to send a message to the robot users in response to any message from them AND

I really want to use cURL
$content = file_get_contents("php://input");
$update = json_decode($content, true);

$chat_id = $update[‘message’][‘chat’][‘id’];
echo $chat_id;

$ch = curl_init();
$url = "https://api.telegram.org/bot" . bot_token . "/";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, "sendMessage?chat_id=" . $chat_id . "&text=hello");
$res = curl_exec($ch);

sendMessage is URL Path, not POST Body.

URL should be …/bot123:AA/sendMessage.
Read more

Leave a Reply

Your email address will not be published. Required fields are marked *