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

How to manage too many messages sended to my bot?

I have implemented a php telegram-bot (https://github.com/php-telegram-bot/example-bot). I'm using the getUpdates method to recieve the messages sended to my bot. The problem is that there are too many spam users sending him fake messages and for…
2
votes
0 answers

Get file_path but do not send as reply in telegram bot

I'm making a telegram bot. And I want to receive a photo and show it to the user again. For example, take a photo of the user and send it back with text to user. I am taking a file_path, but when I call the "sendPhoto" function, the photo will not…
morteza
  • 33
  • 1
  • 4
2
votes
1 answer

PHP Telegram Bot | How to set automatic welcome? (without /start)

I created a bot in PHP and added it to my group, That members of the group could send commands to the bot through the group. What I want to do now is that once a new user has entered the group ($username has joined the group) Will appear to him some…
2
votes
1 answer

Send multiple messages with telegram and webhook

I set a webhook with telegram and basically use this code to send messages to telegram from my server: header("Content-Type: application/json"); $parameters = array('chat_id' => xxx, "text" => "hi there"); $parameters["method"] =…
Ferex
  • 553
  • 6
  • 22
2
votes
3 answers

displaying tables with a telegram bot?

I'm going to need to display a list of results as a response from a telegram bot I'm working on, and was wondering what's the best way of doing that... I could "calculate" the amount of spaces I need to make it look semi-normal, but I'd rather have…
trueicecold
  • 820
  • 10
  • 23
2
votes
1 answer

Upload file on Telegram with bot

I want to send file from URL to user with Telegram Bots, My files extension in .attheme but I can't upload this files from Url. Currently I can upload .zip , .pdf, but i want upload a .attheme file from PHP code. This bot can upload any type of…
2
votes
1 answer

send inline keyboard like t.me/username but for userid in telegram php

I want to send an inline keyboard in which get the user into somebodey's chat whit his chat_id . I know that i can set a Url for inline keyboard like: t.me/username but something like that doesn't work with chat_id : t.me/123456 How to do that ?
hsasan rajaee
  • 25
  • 1
  • 3
2
votes
0 answers

Notification of new telegram private channel member/subscribers

Is there any way to set up a notification system that sends the username of every new member/subscriber that joins your own private telegram channel to you, via message/email/any other method. Has anybody done this before or have any ideas about…
2
votes
1 answer

Can you create Telegram Channels/Groups using the API?

I am hoping to use the Telegram API to create channels and groups. Also hoping that these can be set from the API, such as Private or Public channels, etc. Is this possible?
BrendanC
  • 41
  • 5
2
votes
0 answers

Answering To Telegram Users Separately

I'm working on a Content Management System using PHP for controlling over my Telegram Bot. Basically what I have done till now is that I can read the messages that people has sent to my Telegram Bot and answer to them. In order to do that, I coded…
user6430126
2
votes
4 answers

PHP For Loop Does Not Seem To Be Working

I'm making a Control Panel to manage my Telegram Bot using Telegram Bot API & PHP. Basically, I want to display every message by a single user in a small chat box. Because there are potentially more users who had sent message to the Bot, I have to…
user8454964
2
votes
3 answers

Attach file on telegram with long message

I need send to telegram long text with music/video/Doc. How can send long text with video/music/doc using bot? When upload file to server, telegram send me file_id and file Describe; how to attach this to my long text ?
user298025
  • 21
  • 1
  • 3
2
votes
0 answers

PHP Telegram Bot (editMessageText & editReplyMarkup)

I am Kevin and these days I'm having problems with the functions editMessageText and editReplyMarkup. This is my code and I don't know where is the problem. This is my code:
2
votes
0 answers

how to show telegram bot keyboard to specific users in groups with mention?

i wrote php code for show keyboard to specific user in telegram bot but it's not working $keyboradsValue = array( array("offtimeon","button 2"), array("button 3","button 4"), ); $replyMarkup = array( 'keyboard' => $keyboradsValue, …
2
votes
1 answer

PHP - How to read the text of a button that was clicked on ReplyKeyboardMarkup (Telegram bot)

I want to know hot to read and save into a variable the text of a button that was clicked by a user who chat with my telegram bot. PROBLEM: I have this piece of code that helps me to take the webhook response for my bot. $getupdates =…