当我的Telegram bot将sendMessage发送到Telegram服务器时,它会收到错误消息:
{"ok":false,"error_code":400,"description":"Bad Request: message text is empty"}
Run Code Online (Sandbox Code Playgroud)
今天早上出现问题,在此之前我的机器人工作了整整一年没有错误.GetUpdates命令与以前一样运行良好.我使用GET HTTP方法发送逗号:
https://api.telegram.org/bot<MyToken>/sendMessage
Run Code Online (Sandbox Code Playgroud)
附带UTF-8编码数据:
{"chat_id":123456789,"text":"any text"}
Run Code Online (Sandbox Code Playgroud)
有没有遇到过这个?
如果问题仍然存在,请尝试修改您的 curl 请求。对我来说添加标题
'Content-Type: application/json'和-d '{"chat_id":12309832,"text":"any text"}'固定问题
小智 9
通过模拟表单发送消息的另一种方法:
curl -s -X POST https://api.telegram.org/bot{apitoken}/sendMessage \
-F chat_id='-1234567890' -F text='test message'
| 归档时间: |
|
| 查看次数: |
4095 次 |
| 最近记录: |