首页 > 解决方案 > Slack API 对话。回复 internal_error

问题描述

当有人使用 python slack api 向私人 slack 频道发布消息时,我试图获得线程回复,但我不断收到以下错误:

{"ok":false,"error":"internal_error","warning":"missing_charset",
 "response_metadata":{"warnings":["missing_charset"]}}

我的用户令牌的范围是:channels:history、、groups:historychat:write

这是我的代码:

slack_client = WebClient(token='xoxp-xxxx-xxxx-xxxx-xxxx')

resp = slack_client.api_call(api_method="conversations.replies",
                             json={"channel": 'xxxx',
                                   "ts": received_data['event']['thread_ts'], 
                                   "token": 'xoxp-xxxx-xxxx-xxxx-xxxx'})

我得到同样的错误使用curl

curl -X POST -H 'Authorization: Bearer xoxp-xxxx-xxxx-xxxx' -H "Content-type: application/json"
--data '{"token": "xoxp-xxxx-xxxx-xxxx-xxxx","ts":"1595895414.009700", "channel": "xxxx"}'
https://slack.com/api/conversations.replies

标签: pythonslackslack-api

解决方案


我认为你必须使用GET方法

您可以在方法中添加http_verb="GET"参数api_call

还有一个conversations_replies包装这个调用的方法


推荐阅读