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
6
votes
2 answers

How can I get a list of all messages in Telegram group via the Bot API?

I have a bot in Telegram, which query can I get a list of all messages in a group or channel? As I understand, requests like: https://api.telegram.org/bot_token/getUpdates?chat_id=@chat Let me get only updates, but how can I get a full list of…
Dmitry Maslennikov
  • 338
  • 2
  • 8
  • 22
6
votes
2 answers

Telegram Bot Inline Keyboard not displaying PHP

The following code works, it adds custom keyboard keys 'Button1' and 'Button2' $keyboard = [ 'keyboard' => [['Button1'],['Button2']], 'resize_keyboard' => true, 'one_time_keyboard' => true, …
dean2020
  • 645
  • 2
  • 8
  • 25
6
votes
6 answers

my telegram bot keeps sending messages endlessly

I Started programming a telegram bot and I've got a problem. when I send /start command it sends me a welcome message (as i programmed it) but it doesn't sends it once! it keeps sending it endlessly like loop! this is the source:
5
votes
2 answers

making telegram bot without HTTPS

I'm trying to make a bot to connect to my web host and access database and interact with PHP. But I searched a lot and find out that I need to have SSL certificate .Is there any way to set up a bot without Having SSl ?
j edgar
  • 149
  • 1
  • 10
4
votes
3 answers

Force closure of the popup on telegram “Open this link?”

When i use html formatting in a post and i create a link, Telegram show a popup before open the link. There is a script or something that force closure of the popup and open the link immediatly? I don't want insert the link without HTML.
4
votes
2 answers

Chat API to add and remove members automatically

I'm working with a guy who uses telegram app to send bet tips on football matches. He wants the group to be private, right now he is adding and removing all members manually. The group is growing and now has more than 300 members which makes his job…
João Teixeira
  • 41
  • 1
  • 1
  • 2
4
votes
2 answers

How to make telegram keyboard button issue commands?

I just got acquainted with the keyboard buttons for telegram bots using the .KeyboardButton from the Telegram API documentation but I have an issue; so far I've only been able to design the buttons such that the output after clicking on the button…
4
votes
1 answer

How to get Telegram webhook with ngrok working?

I'm developing a Telegram bot and want to use ngrok to receive messages from the webhook. Setting a webhook works. When I set my publicly reachable domain as URL, I actually get the expected messages. Now, when I know, that the code is working, I…
automatix
  • 14,018
  • 26
  • 105
  • 230
4
votes
3 answers

Telegram Bot: How to get callback_data value?

I have a simple bot in Telegram. My "/select" command displays two buttons and each button has its own value. So, if user clicks on a button I can get the text, but I can't get the callback_data value. Not sure what I am doing wrong. Here's the…
4
votes
3 answers

How Miniaturize telegram bot button

$media[]=['⬅️','']; It's my telegram bot buttons. it's very large i don't like this. How Can I Miniaturize telegram button? I think i need this : resize_keyboard But i don't know how use this for Miniaturize buttons. its my function…
user8729088
4
votes
3 answers

How to send big files from URL to Telegram bot?

I have some big size files (in MP4 and Zip formats) and I want to send them to my chat by Telegram bot, I used the code below: file_get_contents('https://api.telegram.org/bot[[app:token]]/sendDocument?chat_id=24523586&document='.$fileAddress); But…
Ali YQB
  • 73
  • 1
  • 2
  • 8
4
votes
4 answers

Telegram bots read channel updates

As telegram bots reads groups updates, is there any way to read channel updates also?
mohammad falahat
  • 757
  • 1
  • 4
  • 11
4
votes
1 answer

How to download full size photo using Telegram Bot API uploaded from user

I'm working on a telegram bot and I need to download photo, audio, video sent by user to the bot. Using the only path returned by the get file method I only get a thumbnail. In fact the only result of the get file method contains a really tiny value…
ela
  • 104
  • 1
  • 10
3
votes
1 answer

Hot to get callback data from telegram bot message

I'm developing a Telegram Bot via PHP and I want users to answer bot question. For Example: Bot: What is your name? User: (Reply) But I don't know how to process user reply for specific question from bot. If I receive user reply via webhook, it…
3
votes
2 answers

Telegram Bot - Expandable Menu at the bottom

How do I create a menu like the one at the left-hand side bottom of the Telegram bot? Any pointers would be very much appreciated.
Indark
  • 322
  • 1
  • 2
  • 14
1
2
3
22 23