Telegram bot webhook returns user identifier id as null
Asked Answered
S

0

2

I am working on a telegram bot and set up a webhook to store chat id of users into my laravel app's DB.

I was getting the chat id previously but today, I getting NULL.

I am using ngok for https to work with webhooks.

When webhook is deleted and I used /getUpdates method on telegram api, that time I am getting chat id, but I need to use webhook, this is my project's requirement.

array (
  'update_id' => 995486499,
  'message' => 
  array (
    'message_id' => 3,
    'from' => 
    array (
      'id' => NULL,           <----------- This message.from.id is NULL in webhook response
      'is_bot' => false,
      'first_name' => 'XXXX',
      'last_name' => 'XXXX',
      'username' => 'XXXX',
      'language_code' => 'en',
    ),
    'chat' => 
    array (
      'id' => NULL,                 <----------- This chat.id is NULL in webhook response
      'first_name' => 'XXXX',
      'last_name' => 'XXXX',
      'username' => 'XXXX',
      'type' => 'private',
    ),
    'date' => 1629195470,
    'text' => 'hello world',
  ),
)
Serpent answered 17/8, 2021 at 10:31 Comment(4)
Haven't worked with this. Assuming post data format has changed which telegram was sending to webhook. dump $_REQUEST in the first line of your webhook and look for chat id.Norvun
@Norvun tried it, it is same i.e. NULLSerpent
It might be due to the change of userId to int64. I remember a Telegram notice regarding this. check this link out, see if it's the same case for you.Gnu
@AliPadida my PHP_INT_MAX is showing 9223372036854775807 this should not be the issue.Serpent

© 2022 - 2025 — McMap. All rights reserved.