I am using irazasyed.github.io Telegram SDK for sending message here is my code when I send message to bot nothing happen and no reply receives Where is the problem ?
MY_BOT_TOKEN is replaced
<?php
require 'vendor/autoload.php';
use Telegram\Bot\Api;
$telegram = new Api('MY_BOT_TOKEN');
$update = json_decode( file_get_contents( 'php://input' ) );
$chat_id = $update->getMessage()->getChat()->getId();
$response = $telegram->sendMessage([
'chat_id' => $chat_id;
'text' => 'Hello World'
]);
$response->getMessageId();
?>
json_decodedoes not return an object that has those methods. Correct me if I'm wrong, but you should be getting an error stating that the$updateobject does not have those methods. For more information on what thejson_decodefunction should return, check out the manual page for that function. - meun5