我尝试了以下内容:
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":"[Error]: Bad Request: there is no document in request"}
我做错了什么?
Here是关于sendDocument
方法的一些文档。
答案 0 :(得分:10)
希望这会有所帮助。请注意,<token>
之前有“bot”。
curl -F chat_id="<chat_id>" -F document=@"path/to/some.file" https://api.telegram.org/bot<token>/sendDocument