【发布时间】:2020-02-08 13:45:59
【问题描述】:
我在玩 Slack api 方面非常(非常)新手 - 所以要温柔并使用简短的词。到目前为止,我已经设法建立了一个简单的系统,可以发布到我们的 Slack 频道。一切都很好,但与帖子关联的图标是默认的。如何设置不同的图标,甚至是我自己创建的图标?
这里是基本代码(摘自 Slack api 开发网站上列出的教程):
import requests
import json
url = 'https://slack.com/api/chat.postMessage'
token = 'xoxb-00000000000etc'
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer {0}'.format(token)}
def send_message(message_text):
message = {'channel': '#channel_name', 'text': message_text}
requests.post(url, headers=headers, data=json.dumps(message))
send_message('beep boop - this is the OMS bot calling')
非常感谢...
【问题讨论】:
标签: python-3.x slack slack-api