使用 Rundeck 将照片发送到 Bot 电报

问题描述 投票:0回答:1

我正在使用 Rundeck 进行一些自动化,并且我已经使用它通过机器人将消息发送到特定的 Telegram Grops。

我用的是

"HTTP Request Step" with "https://api.telegram.org/<BOT>/sendMessage"  

和 2 个输入选项

{ "chat_id": "${option.chatid}",  "text": "${option.corpo}" }
效果完美!

现在我正在尝试改进它发送照片:

https://api.telegram.org/<BOT>/sendPhoto 
这3个输入选项
{ "chat_id": "${option.chatid}", "text": "${option.corpo}", "file": "${file.file}" }

文件选项是“文件”类型。

出现的错误是:

{ "ok": false, "error_code": 400, "description": "Bad Request: there is no photo in the request" } Error when sending request: Attempted read from closed stream.

你有什么建议吗? 谢谢!

米利奥

我尝试在选项正文中使用“照片”而不是“文件”,但它不起作用。

automation telegram photo rundeck
1个回答
0
投票
  1. sendPhoto
    方法没有
    file
    参数,您需要将照片传递给
    photo
    参数。
  2. 也没有
    text
    参数,在
    caption
     上称为 
    sendPhoto

不是 rundeck 期望的,但似乎你需要类似的东西:

  • file
    photo
  • text
    caption
{ "chat_id": "${option.chatid}", "caption": "${option.corpo}", "photo": "${file.file}" }
© www.soinside.com 2019 - 2024. All rights reserved.