Created
June 30, 2015 19:59
-
-
Save therod/93b1839dbf59c01974ed to your computer and use it in GitHub Desktop.
ruby script that deletes all messages from a defined channel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'slack' | |
require 'json' | |
Slack.configure do |config| | |
config.token = ENV['SLACK_TOKEN'] | |
end | |
Slack.auth_test | |
general = "C06S8GRSL" | |
channel_history = Slack.channels_history(channel: general, count: 1000)["messages"] | |
channel_history.each do |message| | |
response = Slack.chat_delete(ts: message["ts"], channel: general) | |
puts "Deleted Message : #{response["ts"]}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment