【发布时间】:2016-07-07 20:57:57
【问题描述】:
附件在以下代码中不起作用,response_type 也没有按应有的方式显示。我也尝试过使用 Python 的 Slack Client,但发生了完全相同的事情。
def send_message(channel_id, text):
params = {
"token" : token,
"username" : "NEW BOT",
"channel" : channel_id,
"text" : text,
"response_type": "ephemeral",
"attachments": [{ "text":"This is some text" }]
}
headers = {'content-type': 'application/json'}
slack_api = 'https://slack.com/api/chat.postMessage'
requests.get(slack_api, json=params, headers=headers)
return
@app.route('/', methods=['GET', 'POST'])
def main():
if sc.rtm_connect():
sc.rtm_read()
text = request.args.get("text")
channel_id = request.args.get("channel_id")
send_message(channel_id, text)
return Response(), 200
【问题讨论】: