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

Telegram bot add users to channel

I am using laravel-notification-channels/telegram I've implemented welcome notification for my users and my bot sending that message with no issue, the second part of my implementation is to add those users (who I've sent welcome message) into my…
mafortis
  • 6,750
  • 23
  • 130
  • 288
1
vote
0 answers

Get updates to telegram channel comments to the message

We can get message from user in telegram by getupdates api. But for comments in telegram channel message which is introduced by telegram recently I don't get any response. Anyway to do it?
1
vote
1 answer

Telegram bots not working After this error:Account Suspended

Hello My hosting account was blocked, but reopened after 6 hours, But my robots didn't work anymore, I tried the setwebhook again, but it didn't work. What should I do?
sina parse
  • 11
  • 4
1
vote
1 answer

Telegram Bot join new user to kick and keep whitelist a member of private group?

I'm trying telegram bot of Webhook ex. new user join check database not my membership to kick user!
1
vote
1 answer

Telegram bot setMyCommands not working (PHP)

I tried to follow the API to set my bot commands, but it is not working. Here is the function: function setMyCommands($cmds) { $cmds_encoded = json_encode($cmds); apiRequest("setMyCommands?commands=".$cmds_encoded); } This is the commands…
Martin
  • 155
  • 10
1
vote
1 answer

get Full message from telegram bot

I want to get the full message sent by the person's ID in telegram bot , including all the attached files, such as a photo , audio, image, or a caption and photo ... , and send it to another person's ID. I don't want it to be forward , I want to be…
1
vote
1 answer

Telegram bot get forward_from user id

I'm trying to get the id of a user whose message has been forwarded. Like Message forwarded from X and I need to get X id I tried with this but I don't receive anything about forward_from
Erry215
  • 326
  • 1
  • 4
  • 15
1
vote
1 answer

Send xls file Telegram bot

i'm trying to send a xls file. Looking online and after 2 hours, I didn't figure out where is it the error. I'm trying to send this file from an url. Here's my code $filePath = $dburl."Last_season.xls"; $document = new CURLFile($filePath); $post =…
Erry215
  • 326
  • 1
  • 4
  • 15
1
vote
1 answer

Telegram-Bot problem with a command (php)

i'm making a Telegram bot using php language, i want to add a cooldown to a command, i already tried with sleep(), but the result still the same, it doesn't work, someone can help me? At least this is possible? or i need to re code the bot in…
Lyuk
  • 11
  • 2
1
vote
1 answer

Telegram sendPhoto method don't refresh

I'm using a simple bot code which takes an Image from a php page created using: header("Content-type: image/png"); and imagepng(); Here is the bot code: if ($text == "/photo") { $reply_markup = [ "inline_keyboard" => [ [ [ …
Erry215
  • 326
  • 1
  • 4
  • 15
1
vote
1 answer

Is it possible to send a keyboard without sending text or a message at telegram

I try to send and delete the message but not working if($new = $bot->sendMessage([ 'chat_id' => $call_chat_id, 'text' => ' ', 'parse_mode' => 'HTML', 'reply_markup' => $choose, ])){ …
Miki
  • 157
  • 1
  • 8
1
vote
2 answers

Can I use telegram API methods for Telegram Bot?

can I use some methods from here - Telegram API for my Telegram Bot. I am asking because I need in a methods which no present in Telegram Bot Api. If yes, please write How I can to do that.
Aleks
  • 147
  • 10
1
vote
0 answers

Telegram Api - is there a way to add people to a channel/group using phone number instead username?

Actually my script can add people to group, using username. I wonder if it's possible to do the same using phone number.. Telegram api is not clarely about that. Thanks :)
David Mota
  • 49
  • 3
1
vote
1 answer

Shutdown through ssh not working properly

so here is my problem: I have a pc that i use mainly through ssh and i recently created a telegram bot to quickly perform those commands used more frequently. It works fine except for the shutdown command. $connection =…
1
vote
1 answer

Transfer control with inline buttons in telegram (bots)

If you have a bot-generated in-line button in a chat, that inline button can be used to take you to a bot. My question is - is the reverse possible? Can the bot have an inline button (when directly communicating with it) and it can transfer control…