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
0
votes
1 answer

not create keyboard "inline_keyboard" with URL+GET arguman in telegram

problem create keyboard inline_keyboard with URL in telegram when iam use "&" in address url, keyboard not create in to telegram?!!!!!!! this code is work: $text =…
0
votes
1 answer

How to use Telegram bot api to send messages after blocking?

I'm create a telegram bot with https://github.com/php-telegram-bot/core/. Bot is located in Russia. In some reason, Russian authority block some Telegram features and my bot can't send messages to registered users. To avoid it, I'm trying to use…
Evgeniy
  • 3,219
  • 5
  • 25
  • 40
0
votes
1 answer

Event fire when new member has joined the telegram group

I am new to the telegram. I need to develop a bot which will redirect to a visitor from my website to my telegram group. When a visitor will join the group then the user should redirect to a URL. Can anybody please suggest me the workflow or…
Tripti
  • 1
  • 2
0
votes
1 answer

PHP, properly split a multidimensional array and use it in loop

I'm stuck on this task - to divide the array into two and process it. The situation is as follows: $selectCity = "select districtName from telegramCity limit 12 offset 0"; $result = mysqli_query($this->connection, $selectCity); while ($row =…
Bipa
  • 271
  • 1
  • 3
  • 10
0
votes
1 answer

Get chat_id from bot to bot conversation

So What Im trying to accomplish is a bot that forwards messages from one specific user to one specific group chat. I started my testing by using my own chat_id and the bot perfectly forwards my messages to the right groupchat. The problem is tho,…
koolmees
  • 2,725
  • 9
  • 23
0
votes
1 answer

Telegram API Error with Farsi words

I was trying to send Farsi message from server to telegram and I got this error: PHP Warning: …
0
votes
1 answer

Simulate sending a message to a bot from url

I'm trying to simulate how to send a message to a bot from a url but it doesn't work. I try to explain (note: all the ids and tokens are not real, they are only to explain !!) .. I've built a first bot from BotFather named Bot1Bot and then, form url…
Cesare
  • 1,629
  • 9
  • 30
  • 72
0
votes
1 answer

How send list of entitties via telegram bot?

I need send multiple entries from my bot to user. This is solved by repeatedly calling the sendMessage method? Or specific method exist for this?
Alexander
  • 85
  • 1
  • 7
0
votes
1 answer

How to remove service messages from Telegram with Bot API?

I have a supergroup in Telegram and a Bot, which is administrator of a group. When a new user join or left group, service message (with grey background) is appear in chat, for example Username join to a chat Username is join to a chat by invite…
Evgeniy
  • 3,219
  • 5
  • 25
  • 40
0
votes
2 answers

how to implement pagination in telegram bot?

I need to implement pagination for list of entities in a telegram bot's reply keyboard. the problem is that i need to have a show more button that loads next set of entities and i don't know how to get the page that user is currently viewing. the…
Saeid Raei
  • 128
  • 2
  • 12
0
votes
1 answer

Returning Telegram Users Messages From Bot And Answering To Them

My question is a little complicated so I would rather to go for some explanations before asking the main questions. I'm making a Content Management System for managing my Telegram Bot and get the latest updates by that. Basically what I have done…
user9115161
0
votes
1 answer

Why does my Telegram bot send message endlessly

I am creating a telegram bot with Yii2 and my code for WebHook looks like this: public function actionGetUpdates() { $telegram = new Telegram('484152800:A*************************'); $request = file_get_contents('php://input'); …
Donik
  • 33
  • 6
0
votes
2 answers

How can I give Telegram bot methods result in PHP?

I want to give telegram bot methods result like…
Mhdi
  • 11
  • 5
0
votes
1 answer

How to delete Telegram message from certain chat members?

I have a Telegram bot, which is group admininstator and can handle all group messages. As I understand, when group member send message, it deliver to all group members (bot receive message too). Can I delete group message from certain chat members,…
Evgeniy
  • 3,219
  • 5
  • 25
  • 40
0
votes
3 answers

How to get contents of a webpage with PHP

I'm working with PHP to manage my Telegram Bot. Basically Telegram had added a feature which can lets users to get updates from their bots within this url: https://api.telegram.org/bot[TOKEN_NUMBER] Now I want to know, the bot that I'm going to…
user8454964