Created
April 25, 2020 18:54
-
-
Save sasasin/28fbb22d3e40dd8518be5f2f30df5e42 to your computer and use it in GitHub Desktop.
slack_slash_command.rb
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
#!/usr/bin/env ruby | |
require 'slack-ruby-client' | |
Slack.configure do |config| | |
config.token = ENV['SLACK_API_TOKEN'] | |
end | |
client = Slack::Web::Client.new | |
channel_name = ARGV[0] | |
slash_command = ARGV[1] | |
message_text = ARGV[2] | |
channel_id = client.channels_id(channel: channel_name).channel.id | |
response = client.chat_command(channel: channel_id, command: slash_command, text: message_text) | |
pp response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment