user9614762
user9614762

Reputation:

Identify multiple Telegram bots using the same webhook

I have three Telegram bots with the same hook address (or even with three hook addresses). I get input like this:

$content = file_get_contents("php://input");
$update = json_decode($content, true);

How can I recognize which input is sent for which bot?

Upvotes: 1

Views: 633

Answers (1)

Sean Wei
Sean Wei

Reputation: 8015

You can set webhook URL with bot name as the query string.

For instance, use https://t.me/hook.php?bot=Sean, and you can use $_GET['bot'] for each bot.

Upvotes: 4

Related Questions