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
0 answers

Message sending Telegram bot

In php telegram bot, sending message to all user is sent repeatedly to one person. That is, if there are 1000 users, 50 of them will receive messages over and over again. and nothing goes to the rest. How can I solve this? I thought all users would…
Xushnud
  • 1
  • 1
0
votes
1 answer

I want to know how to access incoming messages of Telegram bot without having access to account that created the bot?

I lost access to my old telegram account that had a bot on it with some important stuff. There are still messages incoming on the bot on my old account. I still have the HTTP API token, and have heard that I can access the bot from another telegram…
0
votes
1 answer

Telegram bot inline keyboard callback not working

I'm using PHP for the telegram bot. Reply callback is working when the callback hit the callback URL but the inline keyboard callback not working. When I click on the inline keyboard button, nothing responds, why it's happening? Please help me to…
0
votes
1 answer

Telegram bots API responds 403 Forbidden - when send direct message to bot

$apiToken = "5232750517:AAF7gbXCwZdfhSQeZZb53-2NhTm2xxNuT3U"; $data = [ 'chat_id' => '5232750517', 'text' => 'Hello World' ]; $response =…
wieb
  • 113
  • 1
  • 2
  • 11
0
votes
1 answer

Telegram: links from Amazon don't always open in the app

I'm running a Telegram network where I post discounts from Amazon on a daily basis. Now this is the problem: when I click on the links from my smartphone, they don't always open the Amazon app, but sometimes Telegram opens the page in its in-app…
Oni-Link
  • 1
  • 2
0
votes
1 answer

Send message telegram using PHP

I had telegram bot codes written at PHP, it has many commands. All commands work perfectly except for one. Here is this code. It had to send a message to bot users. if($text == '/send' and isset($reply_to_message) and $chat_id ==…
Hayrulla Melibayev
  • 462
  • 1
  • 5
  • 20
0
votes
0 answers

Telegram API Send Media Group using php (query images from mysql)

Need some help regarding Telegram Send Media Group to send multiple images to a group. I followed few steps given on stackoverflow previously, so far I can query the image path from MySQL & send images to the group, but unable to send multiple at…
0
votes
1 answer

telegram bot goes into infinite loop when iterating over a big list on the backend

hello so i am trying to add broadcast command to my telegram bot which broadcast a specific message to all my bot subscribers which ids are saved in mysql database but the loop never seem to end and restarts after a random amount of sent…
0
votes
1 answer

how to use login_url in telegram bot with php

hi guy does anyone knows about using inline keyboard in telegram bot for login_url ? i just write this code for inlinekeyboard to take users to my website and login with telegram but it doesnt work my…
0
votes
1 answer

Reply keyboard markup php bot telegram

just a quick question about a telegram php bot (the bot is set as webhook on heroku) I currently have the following code:
marko988
  • 33
  • 1
  • 5
0
votes
1 answer

Is there is any way to serve my php app from computer to whole internet?

I am a PHP developing a PHP telegram bot in my VPS. Whenever I have to change something in code I have to first open the file and then edit it then reload the server to see the effect of the changes it's a lot to do is there is any simple way? I can…
Aditya Dev
  • 100
  • 1
  • 8
0
votes
2 answers

Telegram Bot Getupdates API - PHP

I developed a telegram bot whose job is to send the information/message to the group if the user requests it. This is how it works: Suppose If I post the "x player score" text in the group, it would bring the cricket score of that particular player…
Shakti Goyal
  • 127
  • 1
  • 8
0
votes
0 answers

Maximum execution time exceed in long polling

I developed a telegram bot that posts the score of the cricket match in the telegram group. As you know, the score will keep changing within time, So I need to send the message when only the score is updated. To achieve this, I'm using the…
Shakti Goyal
  • 127
  • 1
  • 8
0
votes
0 answers

Send a message when the score gets an update - Telegram Bot

Hope you all are doing great! I developed a telegram bot that posts the score of the match in the telegram group. I already did most of the part but there is something I didn't able to figure out How to post score in the group when the score is…
Shakti Goyal
  • 127
  • 1
  • 8
0
votes
1 answer

Telegram api: how to forward an album

Does anyone know how can I forward an album (which contains multiple medias in it) with telegram api since forwardMessage only gets a message_id, I know this is possible because my friend uses some package in python and he can do that but I couldn't…