Telegram Bot Api sends empty response

I am very new to the Telegram Bot API. Using Laravel.

Now I have this:

Route::get('/test-route', function(){

$response = Http::post('https://api.telegram.org/bot%5BBotToken%5D/sendMessage',
\[

        'chat_id' => '[Chat_Id]',
        'text' => 'test',
        'parse_mode' => 'html',
        'reply_markup' => [
            'keyboard' => [
                [
                  [ 'text' => 'Button 1'], 
                  [ 'text' => 'Button 2'], 
                ],
              ],              
        ],

\]);
dd($response-\>json());
// $responseNew = Http::post('https://api.telegram.org/bot%5BBotToken%5D/setWebhook',\[
//     'url' =\> 'https://\[MyDomain\]/api/webhook/webhook',
// \]);
// dd($responseNew-\>json());
Route::post('/webhook/webhook', \[WebhookController::class, 'index'\]);
public function index(Request $request){

        return view('tests.test', ['webhookData' => $request->all()]);

}

When i send post request to https://[MyDomain]/api/webhook/webhook with PostMan, i have:

<h1>Webhook Data</h1>
<pre>Array
(
)
</pre>

As you can see, it is empty...

No matter what interactions with the Telegram bot i did, the response is empty all the time.

The main goal is to catch and collect users chat_id's (usernames) after they did some interactions with my telegram bot.

I have sent the messages to the bot, clicked on the buttons, then went to the Postman and sent the post request to https://[MyDomain]/api/webhook/webhook

Upvotes: 0

Views: 118

Answers (0)

Related Questions