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

PHP Telegram Bot Message Handler

I want make input message in telegram bot using php language I want something like : When bot say "send your code" The user send something like "AC6J7A" How I can get the code I mean how to make message handler .
-1
votes
1 answer

inline keyboard on telegram error 400 bad request

I wanna send a json encoded keyboard as reply markup but I get error 400 bad requset! This is how json looks like: {"inline_keyboard":[[{"text":"Play, Guitar, Play - \u003Cspan style=\"font-size:14px;\"\u003E Conway Twitty ","callback_data":"some…
-1
votes
1 answer

Edit posts in a Telegram channel after 1 hour using API (PHP)

Is there a way to automatically edit posts in a channel using a bot after 1 hour? For example, I want this message: This is my Ad call me: 2000 Changed to this message after 1 hour: This is my Ad Expired
Moreza7
  • 23
  • 6
-1
votes
1 answer

Php file giving error while using variable

using this php gives error 500, any help is appreciated. what i want is to make the below URL behave like--- api.telegram.org/bot1A/sendMessage?chat_id=@mychannel&text=Hellow
Baba dook
  • 1
  • 1
-1
votes
1 answer

Can telegram Bot to create an chat (group) as administrator and to give access by link?

I did'nt find answer in the manual https://tlgrm.ru/docs/bots/api. Can telegram bot create an groups (chats)?
-1
votes
3 answers

Can chat IDs of telegram bots be changed?

Can we change the chat ID of a telegram bot from Telegram to ID CHAT ? I want to save more chat IDs in my database. To extrapolate it, I use this method: https://api.telegram.org/botXXXXXXXXX:YYYYYYY-YYYYYYYYYYYYYYYYY_YY/getUpdates Besides this, is…
Borja
  • 3,359
  • 7
  • 33
  • 66
-1
votes
2 answers

ways to get chat id of a phone number in telegram bot

I want to know what are the ways to get the chat id of phone numbers in telegram bot programming. I have a small project that I need to get Chatid of a group of phone numbers in telegram very fast .
-1
votes
2 answers

Sending message using Telegram api

I have some PHP code to sending message to Telegram_bot: $telegrambot = "xxxxxxx"; $website="https://api.telegram.org/bot".$telegrambot; $chatId=yyyyyyy; $params=array('chat_id'=>$chatId,'text'=>$msg,); $ch = curl_init($website .…
Avan
  • 25
  • 1
  • 2
-1
votes
1 answer

How to connect telegram bot to vps (windows server)?

i have a Virtual Server (vps) and i have a Telegram bot with php language. my vps is multi user (3 user are using server and i am admin) now i wants connect bot to server , and bot notice me that how login to server. For exapmle : when user 1 login…
Mr.Mmg
  • 53
  • 1
  • 8
-1
votes
1 answer

How to detect at telegram bot script's end that preview was ON when a URL in message was sent by a user in a group

I am Developing a telegram bot. Bot is able to receive messages sent by users in a group. Users send URLs in my group and bot script can detect through entity object whether it is a URL or not. My objective is to detect, when a user send a URL with…
Akash Dwivedi
  • 19
  • 1
  • 8
-1
votes
1 answer

I need to know how can i find my post id in telegram?

I would like to know how can i get the post id like this example from telegram official site (e.g., t.me/durov/43) when i am posting some news in my channel i want to get the post-id and call that post from my another group with url link.
mrfasihi
  • 11
  • 1
  • 1
-1
votes
1 answer

Send different global message in telegram bot

I'm writing telegram bot but i have a problem.I have a database that store my users's user ID After finishing code and running bot , when my bot users become more i can send them commercial post and earn money ,or when i add new features to my bot…
-1
votes
1 answer

I there any way to write any code to get member for telegram channel?

I was reading any answer for this question but no one knows if there any code for any language for get telegram member for channel.if any one knows how it work please answer this question.
-1
votes
1 answer

generate inline keyboard telegram bot from the database

hi I have some product cat in my database I want to generate inline keyboard from the theme but I want to like this we have cat1-ca2-ca3-ca4-ca5 I want to like this cat1 cat2 cat3 cat4 cat5 I need the loop for this result thanks
-1
votes
2 answers

How to get user's non-command answer in PHP Telegram Bot?

I am writing a new Bot for Telegram for the first time using PHP Telegram Bot. Imagine I want to show What is your name? for /start command and wait for user's answer, wait for user's answer and then show Hello USER_NAME to him. I could implement…
Mohammad Saberi
  • 12,864
  • 27
  • 75
  • 127
1 2 3
22
23