【问题标题】:How to POST custom json to telegram api如何将自定义 json 发布到电报 api
【发布时间】:2023-02-05 02:46:15
【问题描述】:

是否可以将自定义 JSON(不是 Telegram API 方法)发送到 Telegram API,以便稍后在 bot 中解析此 POST 请求的主体

JSON 示例:

{
"id":"123456",
"something":"some value"
}

也许方法?

https://api.telegram.org/bot<token>/????????

参数可能?

https://t.me/botname?something=???

如果可能的话,如何捕获这个 json ?

我试图向这个网址发布请求:

https://api.telegram.org/bot_token/
https://t.me/botname
https://t.me/botname?start
https://t.me/botname?custom

【问题讨论】:

    标签: json post telegram-bot py-telegram-bot-api


    【解决方案1】:
    chatid = 0000000000
    token = "0000000000:xxxxxxxxx-xxxxxx-xxxxxxxxxxxxxxxxxx"
    text = 'test-test-test'
    url = f"https://api.telegram.org/bot{token}/sendMessage"
    requests.post(url, data={
            "chat_id": chatid,
            "text": text })
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-09-30
      • 2015-01-21
      • 1970-01-01
      • 2019-12-30
      • 1970-01-01
      • 1970-01-01
      • 2016-02-24
      • 2020-06-14
      相关资源
      最近更新 更多