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

Telegram Inline Bot won't show

I am trying to create a Telegram Bot, I enabled inline from BotFather settings but when I type the bot name it won't show anything except Search... $infoUtente = "Ciao! Io sono $username\n\nIl mio chatId è $chatId\nIl mio nome…
Erry215
  • 326
  • 1
  • 4
  • 15
0
votes
0 answers

How to run this robot on the host?

Hi I posted this question on php-telegram-bot/core/issues in Github but no one answered it! This Telegram-bot doesn't work for me : longman/telegram-bot I used composer require longman/telegram-bot for require project : | vendor --------- > |…
irmmr
  • 39
  • 1
  • 7
0
votes
1 answer

having a predetermined ban list for telegram bot when added to a group

This telegram bot tries to ban a predetermined user IDs each time added to a group. IDs are listed in a file. I'm using this telegram bot class and in webhook method. $telegram = new Telegram($bot_id); $chat_id = $telegram->ChatID(); $button =…
Amir
  • 523
  • 1
  • 5
  • 24
0
votes
0 answers

Implementing a function from another one

this is my first post and im really new to php world, Sorry if i use wrong words or terms to describe my problem. I have a script that was written in php for telegram, and i have two commands that is almost the same. with this one it is possible to…
0
votes
0 answers

Telegram Bot sends same message many times PHP

I am writing a telegram to the php bot, it works fine, but it sends the same message many times, it needs to be sent once, can anyone help me? here is my code function chat_telegram( ) { $token = ; $telegram =…
0
votes
1 answer

How to download photos attached to a message sent to my Telegram bot

The Message object has a photo field, which contains an array of PhotoSize objects. And everything is in order if one photo was sent to the bot, because you can take just the last item. But if several photos are sent, then getting the largest photo…
0
votes
1 answer

How To Automated Push Message At Particular Time Of Day On Telegram Bot Using PHP?

I am trying to push a certain plain text as notification to users through telegram bot using the below mentioned segment of code. The issue that I am facing is that message is not getting pushed out at a given time. Please let me know what can I do.…
Tarun Jain
  • 23
  • 5
0
votes
1 answer

Can a Telegram bot create a survey on a channel?

I’m looking to allow members of a TG channel to generate their own surveys and have the bot post those surveys to the channel. Is this possible? As an extension to this, would it be possible to have the results (votes, not identities) of the survey…
0
votes
1 answer

How change delay time of callbackQuery clocks? in telegram bot sdk php

How can i minimize long pending of clocks display? I use telegram bot sdk php in laravel, all works fine, but when I click on inline button I handle callback_data pending clocks not hidding. I try to reply with answer with answerCallBackQuery , but…
Andrey Fugas
  • 61
  • 1
  • 8
0
votes
0 answers

Telegram Send Document Russian characters in the file name

There is a local file: $file = "some russian text here.txt"; Sent by standard Curl as a document: $ch = curl_init(); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER,…
hopea114y
  • 11
  • 5
0
votes
0 answers

Telegram php: problem with callback_query

I'm new on this forum, the explanation is quite understandable. Below I have reported a simple code where I have 3 buttons online, of which: the url and switch_inline_query checked, while callback_data no. I split chosen if it is a message type or…
Lorenzo
  • 31
  • 4
0
votes
0 answers

The Telegram bot created with Botman does not communicate with Telegram

I created a Telegram Bot using Botman but I can't get it to communicate with the Telegram bees and then interact with it. I state that I configured the bot project following the Botman documentation but after numerous attempts to set the webhook and…
0
votes
1 answer

Callback_query doesn't work (Telegram php bot)

I'm now creating a telegram bot, I made the inline_keyboard (With callback data) and I want that when I press the button "Developer" it will change the message, but when I want to check callback_data value and have a response it doesn't do…
0
votes
1 answer

How to "refresh" the status of file_get_contents('php://input')?

I'm triying to do a BOT for telegram using PHP code. Basically the user have to choose between insert: 1) name 2) surname 3) address choosing surname he have to write his surname and i want to store it into a variabile but, if i use $update =…
Marc Kerf
  • 3
  • 2
0
votes
1 answer

Is there a way to send callback buttons with message in telegram bot?

I am making telegram bot with https://github.com/irazasyed/telegram-bot-sdk . Bot sends pictures and videos, however, I want to send 2 buttons like in this image for callbacks. I have tried keyboards, however, they are not good, as my bot can…
Javid Abbasov
  • 214
  • 1
  • 4
  • 16