Answer the question
In order to leave comments, you need to log in
Is it correct to receive updates from Webhook?
Hello, I use the following construction to get updates:
$data = json_decode(file_get_contents('php://input'));
the handler code itself looks like this:
<?php
include 'functions.php';
$Token = '';
$name = 'ExamplE2019_bot';
$data = json_decode(file_get_contents('php://input'));
$chat_id = '';
$text = $data['message']['text'];
$url = ' https://api.telegram.org/bot '.$Token.'/';
switch($text)
{
case '/start':
sendMessage($url,$chat_id,'ok');
break;
}
As a result, when sending the '/start' message, the bot does not respond. If you comment out the switch part and leave the message sent when the code is called in the browser window, then everything works. Please help me find the problem with this code!
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question