Cannot delete a chat message via Slack API

假装没事ソ 提交于 2019-12-10 18:27:00

问题


I have a Slack team with a public channel. My goal is to use the channel only for announcements posted by bot-A.

I understand that it is not possible to configure Slack channel to be writable for only one person and read-only for the rest, I created a bot-B (Python thing running on an external machine) that monitors the channel via RTM and if there is any message not coming from bot-A, bot-B's task is to delete the message by calling chat.delete (https://api.slack.com/methods/chat.delete). Bot-B is also in the channel.

Unfortunately bot-B is getting "cant_delete_message" which, according to the chat.delete doc, means that he has no permissions.

However, according to https://api.slack.com/bot-users, chat.delete is allowed for Custom Bots.

So is my bot-B not a "Custom Bot"? If so, what does a Custom Bot actually is and how can I create one?

Or what am I doing wrong?


回答1:


I believe that a Slack user (bot or otherwise) is only allowed to delete its own messages. There's no way to delete messages posted by someone else.

EDIT: I stand corrected. Admins can delete other people's messages. From https://get.slack.help/hc/en-us/articles/202395258-Editing-or-deleting-messages:

Owners and Admins can delete messages from any sender as long as the messages are in public or private channels that the Owner or Admin has joined.



来源:https://stackoverflow.com/questions/37923772/cannot-delete-a-chat-message-via-slack-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!