0
我試圖使用Slack的Python客戶端發送附件,但每當我失敗時。我試着將它與Tester一起發送,但它仍然不起作用。要麼我得到{"ok": false,"error": "no_text"}
或者如果我有文本屬性只有文本將被髮送。這就是我的做法。我也搜查了,但沒有發現任何東西。Slack API:無法發送附件
attachment = json.dumps([{"attachments": [{"fallback": "Reddit Message","color": "#448aff","pretext":"You've got a new Message!","author_name": "Reddit","author_link": "https://reddit.com","author_icon": "imageurl","title": "Reddit Message","title_link": "https://reddit.com/message/inbox","text": "This is what I know about it.","fields": [{"title": "Author:","value": str(item.author),"short": "true"},{"title": "Subject: ","value": str(item.subject),"short": "true"},{"title": "Message:","value": str(item.body),"short": "false"}],"footer": "Reddit API","footer_icon": "anotherimageurl"}]})
sc.api_call("chat.postMessage",channel="U64KWRJAU",attachments=attachment,as_user=True)
幫助將不勝感激。這應該是有道理的,但我不明白爲什麼它不起作用
但我沒有發送文件。我正在發送消息附件。 – MatejMecka
信息附件?你的意思是一個片段? –
https://api.slack.com/docs/message-attachments – MatejMecka