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

Join Chats and Channels in MadelineProto Telegram

I'm using the Madeline Project to automate some activities in the telegram communities. Bots are not suitable to do these tasks due to the restrictions they have. So I'm trying to use normal user accounts. Everything works smoothly with some types…
Univers3
  • 935
  • 1
  • 13
  • 34
0
votes
1 answer

channel_post and edited_channel_post response from telegram api

my Bot Recently get chennel_post message type from telegram api. this message type sended by a telegram channel? please help me. Thanks
0
votes
1 answer

Telegram bot: Multiple bots with different routes on same domain

I am using Telegram Bot Php-Sdk. As the question is self explanatory, I am trying to run multiple bots on same domain but different routes. I have a live bot with webhook setup at mybot.domain.com/someroute and a staging bot at…
Talha Malik
  • 1,509
  • 3
  • 22
  • 44
0
votes
1 answer

Telegram Bot getChat method on channels using integer id returns old details

we have a web application,user add our bot in his/her channel as admin ,and can do some stuff from web app(e.g posting/editing items with markup buttons..etc),our app is heavily based on channel integer chat_id (example: chat_id=-1001006616144)…
Arash
  • 639
  • 2
  • 9
  • 15
0
votes
0 answers

How to use telegram api package in CakePHP 3?

I tried to use PHP telegram bot in my CakePHP 3 website, but encountered many problems. done I ran "composer require longman/telegram-bot" and copied package to "plugins" folder. and then "bin/cake plugin load longman/telegram-bot". questions 1.…
mitra razmara
  • 745
  • 6
  • 10
0
votes
1 answer

How to get the latest telegram channel post in PHP?

How can I get the last telegram channel post in PHP? For example, I can get the channel member count with this: file_get_contents("https://api.telegram.org/botTOKEN/getChatMembersCount?chat_id=@channelusername");
Ali YQB
  • 73
  • 1
  • 2
  • 8
0
votes
1 answer

How can wait my Telegram Bot for a incoming message?

How can I let interact my Telegram Bot with Users? E.g.: User: /buy Bot: What do you want to buy? User: Icecream Bot: You have successfully bought Icecream! So how can I do this? switch($message) { [...] case "/buy": sendMessage($chatID, "What…
Deeonix
  • 5
  • 4
0
votes
0 answers

how to send an alert message by telegram bot?

i want to send timed message likes @alertbot, my code like this. but at 20.30 the bot doesnt send any message. date_default_timezone_set("mytimezone"); $time = date(H:i); $date = date(d/m/Y); $pesan = “/alert 20:30 27/04/2017 some texts”; $chatid =…
achmad311
  • 21
  • 6
0
votes
1 answer

how update InlineQueryResultArticle after click callback_data

i want update input_message_content in InlineQueryResultArticle after clicking callback_data button how do it?
kamal
  • 330
  • 3
  • 13
0
votes
4 answers

self signed certificate for telegram bot in php curl

I just wanna send a simple request to telegram bot APIs my code is: $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.telegram.org/bot332537240:MY_TOKEN/getUpdates", CURLOPT_CUSTOMREQUEST => "POST", )); $response…
reza
  • 1,746
  • 6
  • 16
  • 32
0
votes
1 answer

telegram game bot using unreal4u/telegram-api PHP

I'm trying to create a bot game with official PHP API that linked https://github.com/unreal4u/telegram-api In this section, I am trying to send my own game with a play button. by this codes, my game will send by image and telegram default button.…
user6691484
0
votes
2 answers

Create chat id in telegram from api or dynamic for send message to bot

I have prepared one api in php for send message to bot. Every time, I need to pass chat_id in api call. Anyone know how can i create unique chat id for send message to bot. Thanks in advance.
0
votes
1 answer

Telegram Bot Game not working

I am realizing my bot telegram with a game. I wrote this: $content = file_get_contents("php://input"); $update = json_decode($content, true); if(!$update) { exit; } $chatId = isset($message['chat']['id']) ? $message['chat']['id'] :…
Matteo Enna
  • 1,285
  • 1
  • 15
  • 36
0
votes
0 answers

php telegram bot empty request

as the title suggests, I'm having a problem with my Telegram bot. First a few things I want to clarify before i explain my problem. The Bot used to work earlier, received its updates, processed them and sent back a message with the calculated…
Tobias F.
  • 1,050
  • 1
  • 11
  • 23
0
votes
1 answer

i made a button but i can not answer to button in the inline keybord

When I click on inline keyboard, I can not get no answer our .Help me please? This is my code: if ($data == "1") { $message = 's'; $url = 'https://api.telegram.org/bot'.$token.'/sendMessage?chat_id='.$user_id.'&text='.$message; $update =…