Answer the question
In order to leave comments, you need to log in
Button in telegram bot in php?
There is a telegram bot questionnaire in php .
Questionnaires in it open with links like https://t.me/car_bot?start=worksheet3de89191 which you send to the user.
The problem is that if the user is new and has not launched the bot before, then this link is not activated from the first click (first, you need to click on the link at the start of the bot and then if you follow the link again, it will be activated and the user can go through the points of the questionnaire)
This leads the user to a stupor and if he is not diligent)) - he thinks that the bot is not working and leaves
After the start command, the bot displays startHello
How to make a button with this link after the user's greeting word in this code?
<?php
abstract class Start
{
/**
* @param $wh WebHook
*/
public static function run($wh)
{
$wh->bot->sendMessage(
$wh->user->telegram_id,
$wh->lang->getParam(
"startHello",
[
"name" => $wh->user->getFullName()
]
)
);
}
}
Answer the question
In order to leave comments, you need to log in
Before sending a message, you need to check the existence of the user, then parse the received /start command. When the bot is launched using your link, the following parameters are passed to the $data['message']['text'] variable: /start worksheet3de89191
$data['message']['text'] => '/start worksheet3de89191'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question