python - Slack API 对话。回复 internal_error
问题描述
当有人使用 python slack api 向私人 slack 频道发布消息时,我试图获得线程回复,但我不断收到以下错误:
{"ok":false,"error":"internal_error","warning":"missing_charset",
"response_metadata":{"warnings":["missing_charset"]}}
我的用户令牌的范围是:channels:history
、、groups:history
和chat: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
解决方案
我认为你必须使用GET
方法
您可以在方法中添加http_verb="GET"
参数api_call
还有一个conversations_replies
包装这个调用的方法
推荐阅读
- tensorflow - TOCO 无法将 .pb 转换为 .tflite keras 的 ConverterError
- php - 来自数据库的图像不显示在网页上
- php - PHP Curl在浏览器上返回空字符串,在邮递员中工作
- python - 时间数据 2019-03-31T01:55:00CET 与指定的熊猫格式不匹配
- jquery - 从子元素更改 jQuery 对话框标题
- haskell - 是否有一个标准的 Haskell 函数,其类型为:(Floating a, RealFrac b) => a -> b?
- c# - 将访问令牌作为 URL 查询参数传递?
- c# - 用于 GCP KMS 非对称解密的 C# 加密示例
- uwp - 合成 - 为什么我的元素会立即在我的动画上设置模糊?
- html - 如何在导航菜单中添加按钮?