Questions tagged [php-telegram-bot]

The telegram Bots are applications that can be used via telegram chat, the interaction is via Messages. The realization of these bots with PHP simplifies the work of a developer.

It is implemented by API and HTTP-based interface has all the methods of bot telegram (https://stackoverflow.com/tags/telegram-bot/info).

A simple way of use is:

define('BOT_TOKEN', '<YOUR-TOKEN>');
define('API_URL', 'https://api.telegram.org/bot'.BOT_TOKEN.'/');
define('FILE_URL', 'https://api.telegram.org/file/bot'.BOT_TOKEN.'/');

$content = file_get_contents("php://input");
$update = json_decode($content, true);

$message = isset($update['message']) ? $update['message'] : "";
$chatId = isset($message['chat']['id']) ? $message['chat']['id'] : "";
$text = isset($message['text']) ? $message['text'] : "";

header("Content-Type: application/json");
$parameters = array('chat_id' => $chatId, "text" => 'you wrote: '.$text);
$parameters["method"] = "sendMessage";
341 questions
1
vote
1 answer

Telegram bot: a dirctionary of available commands

How to organize a dictionary of available commands for a Telegram bot? How do good programmers do it? I know that writing dozens of if statements is a bad idea, as well as a switch statement. For now it's implemented using switch: The bot receives…
1
vote
1 answer

Iinline keyboard. I made a button, but what to do with the callback_data?

Need help with inline keyboard. I made a button, but what to do with the callback? I understand I need to somehow get a callback_data and issue a new message.
batman
  • 123
  • 1
  • 6
1
vote
1 answer

how to make simple quiz and button answer in telegram bot with php?

I want to make a simple question and the answer in multiple choice, the result what i want is like this picture : this is picture for desired the multiple choice button but the result is not like what i desired this is the picture for result from…
kobaltoloy
  • 149
  • 1
  • 12
0
votes
0 answers

Madelineproto stop all process (stop Eventhandler)

I spend lots of time to discover how i should to stop Eventhandler process but it didn't work this is my code: startAndLoop(Events::class); //…
0
votes
0 answers

Telegram bot response the user requests using telegram-bot-sdk package in Laravel

I am creating a poll. I am using the telegram-bot-sdk package in Laravel. How can I respond to user requests? I want to create a poll using telegram bot and send to the group. First, enter the poll question and enter poll options! Example: Bot: …
0
votes
0 answers

Is there anyway to get a list of all the chat members in Telegram?

Is there anyway to get a full list of the members in a Telegram group? We are selling subscriptions to a Telegram Group/Channel but we have two problems No Join Event on Channels only Groups (So we cannot log people who only join the channel) We…
0
votes
0 answers

PHP Telegram bot: sendMessage not including keyboards

I am trying to send the following array (below is shown the output of print_r($this->arguments, true);), via php, to the Telegram Bot API: Array ( [chat_id] => (omitted) [text] => Work in progress... [reply_markup] => Array ( …
0
votes
0 answers

Integrate a telegram bot developed in php in a telegram channel

I have a channel and I want users (subscribed to the channel) to be able to interact with the bot. Obviously a user can't send message in the channel, but he can interact with the bot, so he can send it messages. Is there a way to use a telegram bot…
Sone
  • 1
  • 1
0
votes
0 answers

Failed to connect to api.telegram.org port 443: Connection refused

I have been having this problem for a few days My host doesn't connect to Telegram APIs Failed to connect to api.telegram.org port 443: Connection refused I couldn't restart it . Is my host banned?
0
votes
1 answer

how to open a android application by telegram bot api inline keyboard php

I want to make the user select a inline button in the Telegram bot to run and open an application installed on the device (if it is installed and available). For example, what can I put in the value of the address in the following code? $keyboard = …
0
votes
1 answer

Telegram Bot API SetChatMenuButton using PHP

anyone can help on how can I implement changing the telegram menu button using PHP, I'm totally new using and understanding it. Any help is well appreciated. TIA. Here's what I'd done, I'm doubting about JSON serialize i'm making here. Looking…
Maharlikan
  • 63
  • 7
0
votes
1 answer

How can i use login_url in inline_keyboard Telegram bot php

I have $inline_button1 = array("text"=>"Text","login_url"=>array("url" => "https://example.com")); $inline_keyboard = [[$inline_button1]]; $keyboard=array("inline_keyboard"=>$inline_keyboard); $replyMarkup = json_encode($keyboard); $tg->send2($id,…
0
votes
0 answers

Get Telegram Bot to join group by link

So I have the link to a group channel which I cannot simply add the bot into. I can join the group with my own account without a problem. I am not the Admin of that group, that is why I can't simply add it into the group. So I wanna get the Bot to…
Jogi
  • 1
0
votes
0 answers

Telegram Bot callBackQuery php,laravel

I want to implement a pagination for telegram bot with inlinekeyboard with nutgram in laravel but when I use inlineKeyboard tow times I get this error: Bad Request: message is not modified: specified new message content and reply markup are exactly…
a14z
  • 1
  • 2