通过curl将文件发布到Telegram Bot API [英] Posting a file via curl to the telegram bot api
本文介绍了通过curl将文件发布到Telegram Bot API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试了以下操作:
curl -F name=document -F upload=@<path_to_the_file> \
-H "Content-Type:multipart/form-data" \
"https://api.telegram.org/bot<token>/sendDocument?chat_id=<chat_id>"
它返回 {"ok":false,"error_code":400,"description":"[错误]:错误的请求:请求中没有文档"}
我做错了什么?
此处是有关 sendDocument
方法的一些文档./p>
Here is some documentation on sendDocument
method.
推荐答案
希望这会有所帮助.请注意,在< token>
之前有一个机器人".
Hope this helps. Note that there is "bot" before <token>
.
curl -F document=@"path/to/some.file" https://api.telegram.org/bot<token>/sendDocument?chat_id=<chat_id>
这篇关于通过curl将文件发布到Telegram Bot API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文