Answer the question
In order to leave comments, you need to log in
How to set a key for a button in a telegram bot?
I am doing this now
$buttons = [
'resize_keyboard' => true,
'keyboard' => [
['Кнопка 1', 'Кнопка 2'],
],
];
$content = array(
'chat_id' => $data['message']['from']['id'],
'reply_markup' => json_encode($buttons),
'text' => "Test"
);
message_to_telegram($content);
function message_to_telegram($array)
{
$ch = curl_init();
curl_setopt_array(
$ch,
array(
CURLOPT_URL => 'https://api.telegram.org/botAPI/sendMessage',
CURLOPT_POST => TRUE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_TIMEOUT => 10,
CURLOPT_POSTFIELDS => $array,
)
);
curl_exec($ch);
}
$buttons = [
'resize_keyboard' => true,
'keyboard' => [
[ 'btn1' => 'Кнопка 1', 'btn2' => 'Кнопка 2'],
],
];
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