【问题标题】:Identify multiple Telegram bots using the same webhook使用同一个 webhook 识别多个 Telegram 机器人
【发布时间】:2018-04-10 04:06:40
【问题描述】:

我有三个具有相同挂钩地址(甚至具有三个挂钩地址)的 Telegram 机器人。我得到这样的输入:

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

我如何识别哪个输入是为哪个机器人发送的?

【问题讨论】:

    标签: php telegram telegram-bot


    【解决方案1】:

    您可以设置 webhook URL 与 bot 名称作为查询字符串。

    例如,使用https://t.me/hook.php?bot=Sean,您可以为每个机器人使用$_GET['bot']

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-10-18
      • 2018-09-15
      • 2017-05-31
      • 2018-10-25
      • 2018-07-29
      • 2015-11-16
      • 1970-01-01
      相关资源
      最近更新 更多