Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot delete a chat message via Slack API

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?

like image 338
Radek Skokan Avatar asked Sep 03 '25 02:09

Radek Skokan


1 Answers

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.

like image 98
user94559 Avatar answered Sep 04 '25 23:09

user94559