N
N
Niko2018-10-27 11:46:27
PHP
Niko, 2018-10-27 11:46:27

How to send a message from the site to Telegram with buttons?

Good afternoon, I want to figure out how to make a button in a Telegram message.
In general, the site has a button "Request a call", a popup opens with a form, there are inputs: Name , Phone they are processed in php and sent to the Cart.
I know about the reply_markup parameter, with which you can send the button, but it doesn't work. I tried everything, maybe I'm doing something wrong. If anyone has experienced this please let me know how you did it.
Send text like this:

$arr = array(
$nameFieldset => $call_name,
$phoneFieldset => $call_phone,
);
foreach($arr as $key => $value) {
$txt .= "<b>".$key."</b> ".$value."%0A";
};
$sendToTelegram = fopen("https://api.telegram.org/bot{$token}/sendMessage?chat_id={$chat_id}&parse_mode=html&text={$txt}","r");

And one more question, is it possible to make the button work as an order acceptance.
Example: The cart receives a message in the following form, where [Pick up order] is a button.
Order number : 15
Name : Fedor
Phone : 732-23-23
[ Pick up order ]
When you click this button, the telegram user ID was taken and instead of this button it was written for everyone: The order was taken by Alexey (@example).
Is it possible to arrange all this?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question