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