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

PHP Longman telegram bot. Can't download files via webhooks

I'm using longman/telegram-bot package at my Yii2 project. class GenericmessageCommand extends SystemCommand { /** * @var string */ protected $name = 'genericmessage'; /** * @var string */ protected $description…
0
votes
1 answer

know the answere of user to the telegram bot

i am a new programmer in the telegram bot i have a php code for my bot const TOKEN = "https://api.telegram.org/bot"; const USER_NAME = "@testbot"; const NAME = "Test bot"; $jata = json_decode(file_get_contents("php://input"),…
user13860000
  • 3
  • 1
  • 2
0
votes
1 answer

How to get user id from @username in Telegram using php

Hi i'm working on a Telegram bot and i need to get the id of any one just form his username. I searched for this question a lot but I did not find a solution and therefore I asked this question here, please help.
sorax
  • 63
  • 1
  • 8
0
votes
1 answer

get message related to InlineKeyboardButton telegram bot after touch it

I have a command to get some suggestion/criticism in some specific categories that are shown as some InlineKeyboardButton. first user touch one of them and then should be send a simple text as suggestion/criticism. this is my command: class…
Ahmad Badpey
  • 6,348
  • 16
  • 93
  • 159
0
votes
1 answer

How I can make a configure AWS EC2 apache server

How I can make configure for an AWS EC2 apache instance server to do the flowing: Accepts incoming POSTs from subnets 149.154.160.0/20 and 91.108.4.0/22 on port 443, 80, 88, or 8443
0
votes
1 answer

send location KeyboardButton does not send any data in php-telegram-bot

I'm using https://github.com/php-telegram-bot/ php library to make a telegram Bot. To get location of user I wrote these Command: public function execute () { $data['chat_id'] = $this->getMessage()->getChat()->getId(); …
Ahmad Badpey
  • 6,348
  • 16
  • 93
  • 159
0
votes
1 answer

Is there a bulk messaging limit in telegram bots?

I was sending messages to all my bot subscribers and when the subscribers reach about 400, my bot doesn't send messages to all but few. my code is in php and I've used the sleep() function. I tested it and found out that while sending the message if…
Miki
  • 157
  • 1
  • 8
0
votes
0 answers

AWS PHP Apache Server Telegram bot

I set all requirements for PHP telegram bot by AWS EC2 instance, with PHP apache server, and work with https at https://waseem.com/index.php and webhook set also. The problem I can get a response from my server to telegram everything well, I need…
0
votes
1 answer

What do I need to do in my PHP file so that my Telegram bot replies to my message in a quote?

I want to make a bot that responds to my message on Telegram. In fact, the bot I wrote responds to me, but it does not respond by quoting my message. What do I need to do in my PHP file so that my Telegram bot replies to my message in a quote? This…
0
votes
1 answer

How can I interact with Telegram’s location?

Below I reported a simple code that allows me to know my current location by clicking the "Current location" button. Once I sent the location I would like to be able to send a message showing the latitude and longitude of the location. I don’t know…
Lorenzo
  • 31
  • 4
0
votes
0 answers

how i can change the flag value

I'm trying to make a flag as a switch "true and false" when the user has clicked the request order button the flag value changing to the "true" and then when the user sent "message" into the chatbot and the flag is true, print work. $flag =…
0
votes
1 answer

How to understand what message from the telegram bot answered the user?

I use Laravel Framework and Telegram Bot SDK. I looked at a lot of guides, and all say how easy it is to create a command and get an answer, but I can’t understand how to create dialogs between the user and the bot. In my webhook I can do for…
0
votes
2 answers

How can I generate a nested array in foreach loop to produce the same result? Telegram PHP Bot

This code snippet: $inline_keyboard = new InlineKeyboard([ ['text' => 'valueA', 'callback_data' => 'valueA'], ], [ ['text' => 'valueB', 'callback_data' => 'valueB'], ]); produces in my telegramm bot the following inline keyboard: So far so…
Deltahost
  • 107
  • 3
  • 11
0
votes
1 answer

How can i count inlineKeyboardButton clicks the same as @ChannelButtonsBot or @likebot?

i can't figure out how can i count inlineKeyboardButton clicks the same as @ChannelButtonsBot or @likebot. How can i make the bot increase by 1 on first click and decrease by 1 on the second click. and of course it needs to know when a new user…
0
votes
1 answer

Telegram Bot Ask Question Without Button like BotFather

I'm trying to get answers from users without sending any button, but when I just send $reply_markup['force_reply'] = true; within the message, the reply is not coming with callback_query. How can I understand the user answering my question? Are…