Slack API chat.update internal_error 通过请求,通过 https://api.slack.com/ 工作
Slack API chat.update internal_error via requests, works via https://api.slack.com/
我正在尝试从我通过机器人发布的消息中删除按钮块
- 权限全部授予(包括必需的chat:write)
- 完全相同的输入(频道、消息、块、ts)与 https://api.slack.com/methods/chat.update/test 中的调用一起工作并正确删除按钮
但是当我的应用程序调用时,它会产生 internal_error 响应
params={
"channel":channel_id, # same as via api.slack.com
"ts":msg_ts, # same as via api.slack.com
"text":msg, # same as via api.slack.com
"token":APP_TOKEN, # same as via api.slack.com
"blocks":[img_block] # same as via api.slack.com, dict (see below for value)
}
r = requests.post("https://slack.com/api/chat.update", params)
块部分,这是关键更改部分(我首先获取所有块,然后通过仅发布图像块来删除按钮块),我在 chrome 的开发工具中看到来自 https://api.slack.com/methods/chat.update/test 等于我的一个应用程序
blocks: [{'type': 'image', 'block_id': 'qtl', 'image_url':
'https://.s3.eu-central-1.amazonaws.com//tmp/filename.png',
'alt_text': 'ALT', 'title': {'type': 'plain_text', 'text': 'TEXT'}}]
blocks: [{'type': 'image', 'block_id': 'qtl', 'image_url':
'https://.s3.eu-central-1.amazonaws.com//tmp/filename.png',
'alt_text': 'ALT', 'title': {'type': 'plain_text', 'text': 'TEXT'}}]
这是一个错误吗? API 文档说明如下
The server could not complete your operation(s) without encountering
an error, likely due to a transient issue on our end. It's possible
some aspect of the operation succeeded before the error was raised.
还有什么我可以尝试的吗?
我终于让它工作了(感谢@Gautam 促使我再次研究这个)
我现在在 headers 中再次添加了令牌,除了在参数中添加了令牌。response/documentation 可能对此更清楚一些
headers = {'Content-Type': 'application/json', 'Accept':'application/json', 'charset':'utf-8', 'Authorization': f'Bearer {APP_TOKEN}'}
r = requests.post("https://slack.com/api/chat.update", json=params, headers=headers)
我正在尝试从我通过机器人发布的消息中删除按钮块
- 权限全部授予(包括必需的chat:write)
- 完全相同的输入(频道、消息、块、ts)与 https://api.slack.com/methods/chat.update/test 中的调用一起工作并正确删除按钮
但是当我的应用程序调用时,它会产生 internal_error 响应
params={
"channel":channel_id, # same as via api.slack.com
"ts":msg_ts, # same as via api.slack.com
"text":msg, # same as via api.slack.com
"token":APP_TOKEN, # same as via api.slack.com
"blocks":[img_block] # same as via api.slack.com, dict (see below for value)
}
r = requests.post("https://slack.com/api/chat.update", params)
块部分,这是关键更改部分(我首先获取所有块,然后通过仅发布图像块来删除按钮块),我在 chrome 的开发工具中看到来自 https://api.slack.com/methods/chat.update/test 等于我的一个应用程序
blocks: [{'type': 'image', 'block_id': 'qtl', 'image_url': 'https://.s3.eu-central-1.amazonaws.com//tmp/filename.png', 'alt_text': 'ALT', 'title': {'type': 'plain_text', 'text': 'TEXT'}}]
blocks: [{'type': 'image', 'block_id': 'qtl', 'image_url': 'https://.s3.eu-central-1.amazonaws.com//tmp/filename.png', 'alt_text': 'ALT', 'title': {'type': 'plain_text', 'text': 'TEXT'}}]
这是一个错误吗? API 文档说明如下
The server could not complete your operation(s) without encountering an error, likely due to a transient issue on our end. It's possible some aspect of the operation succeeded before the error was raised.
还有什么我可以尝试的吗?
我终于让它工作了(感谢@Gautam 促使我再次研究这个)
我现在在 headers 中再次添加了令牌,除了在参数中添加了令牌。response/documentation 可能对此更清楚一些
headers = {'Content-Type': 'application/json', 'Accept':'application/json', 'charset':'utf-8', 'Authorization': f'Bearer {APP_TOKEN}'}
r = requests.post("https://slack.com/api/chat.update", json=params, headers=headers)