question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I do not understand how to delete messages via RTM bot objects...

See original GitHub issue

Slack API supports deleting messages via bot users, as far as I understand with the “as_user=true” argument in api call. In this case it is a RTM API call, not a Web API call.

It looks like this is also possible in the node-slack-sdk, but I am not able to reverse engineer the necessary code…

Something like:

var RTM_EVENTS = require('@slack/client').RTM_EVENTS;

rtm.on(RTM_EVENTS.MESSAGE, function handleRtmMessage(message) {
   rtm.chat.delete("<TIMESTAMP>", "<CHANNEL-ID>", "as_user=true");

This method “chat.delete” is available for the Web API in this wrapper, but only a bot user is allowed to delete on behalf of another user.

The plan is to create a read only channel e.g. through deleting all messages from others than the channel owner…

Thanks for any hints in advance!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
nohir0commented, Sep 17, 2017

@bolekkerous here my code for the Slack Read Only Channel with possibility to invite other member to post for admins… https://github.com/nohir0/slack-channel-readonly

0reactions
bolekkerouscommented, Sep 17, 2017

@nohir0 - thanks a lot, I really appreciate it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Not able to Delete message which is sent by Bot
Hi, my app has been working for many months, now I am facing the problem with deleting the message that should be deleted...
Read more >
Real Time Messaging API | Slack
Event Description Works with app_home_opened User clicked into your App Home Events app_requested User requested an app Events app_uninstalled Your Slack app was uninstalled. Events
Read more >
Cannot delete a chat message via Slack API - Stack Overflow
I believe that a Slack user (bot or otherwise) is only allowed to delete its own messages. There's no way to delete messages...
Read more >
Update and delete messages sent from your bot - Teams
To delete a message, pass that activity's ID to the DeleteActivityAsync method of the TurnContext class. For more information, see TurnContext.
Read more >
RTM API Reference | LiveChat Platform Docs & API Reference
Use the Agent Chat RTM API to send messages, manage access and properties. ... Real-Time Messaging API (RTM API) is based on a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found