Answer the question
In order to leave comments, you need to log in
How to make a button to send text bot telegram?
There is a telegram bot. The teams are ready. We need to make two buttons that will be constantly in front of the user for quick access. I write in procedural php with webhook. I read the documentation and I can't catch up with something, how to use it.
We need a button that will send a message to the chat. Those. the check button will just send a /ckeck message to the chat, how to do it? Everywhere everything is oops or with such bells and whistles that the beginner's jaw drops.
Got
webhook and chatid installed
Thank you!
Answer the question
In order to leave comments, you need to log in
Maybe so?
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.telegram.org/bot598******:AAFx8OAg8dj184XBTldynqezf64trbOQ/sendMessage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\"chat_id\":\"2367*****\",\"text\":\"test message here\"}",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question