diff --git a/lib/bot.rb b/lib/bot.rb new file mode 100644 index 00000000..c522fa47 --- /dev/null +++ b/lib/bot.rb @@ -0,0 +1,47 @@ +require_relative 'user' +# an excessive but object oriented solution +class Bot < User + attr_reader :slack_id, :name, :real_name, :time_zone, :is_bot, :send_as, :emoji + def initialize(slack_id: , name:, real_name:, time_zone: ,is_bot: , send_as: '', emoji: '') + super(slack_id: slack_id, + name: name, + real_name: real_name, + time_zone: time_zone, + is_bot: is_bot) + @send_as = send_as + @emoji = emoji + end + + def self.current_bot + users = User.list_all + url = 'https://slack.com/api/auth.test' + query = {token: Bot.token} + sleep(0.5) + response = HTTParty.get(url, query: query)['user_id'] + user = users.find{ |user| user.slack_id == response} + return Bot.new(slack_id: user.slack_id, + name: user.name, + real_name: user.real_name, + time_zone: user.time_zone, + is_bot: user.is_bot) + end + + def set_emoji(emoji) + # regex checks for correct emoji format: + # (:EMOJI:, EMOJI, alphanumeric and dashes only (can also have exactly TWO colons on either side)) + raise ArgumentError, "invalid emoji" unless /^(:[a-zA-Z0-9_]+:)/ =~ emoji || /^([a-zA-Z0-9_]+)/ =~ emoji + @emoji = emoji + return emoji + end + + def set_send_as (username) + @send_as = username + return username + end + + def self.list_all + bots = super + bots = bots.filter{ |user| user.is_bot || user.slack_id == "USLACKBOT"} + return bots + end +end \ No newline at end of file diff --git a/lib/channel.rb b/lib/channel.rb new file mode 100644 index 00000000..71236353 --- /dev/null +++ b/lib/channel.rb @@ -0,0 +1,34 @@ +require_relative 'recipient' +require 'table_print' + +class Channel < Recipient + attr_reader :topic, :member_count + + def initialize(slack_id:, name:, topic:, member_count:) + super(slack_id: slack_id, name: name) + @topic = topic + @member_count = member_count + end + + def details + tp self, :slack_id, :name, :topic, :member_count + return {"SLACK_ID": @slack_id, + "NAME": @name, + "TOPIC": @topic, + "MEMBER_COUNT": @member_count + } + end + + def self.list_all + url = "https://slack.com/api/conversations.list" + param = {token: Channel.token} + raw_channels = Channel.get(url, param)['channels'] + all_channels = raw_channels.map do |channel| + Channel.new(slack_id: channel["id"], + name: channel["name"], + topic: channel["topic"]["value"], + member_count: channel["num_members"]) + end + return all_channels + end +end \ No newline at end of file diff --git a/lib/recipient.rb b/lib/recipient.rb new file mode 100644 index 00000000..da3ad0db --- /dev/null +++ b/lib/recipient.rb @@ -0,0 +1,64 @@ +require 'httparty' +require_relative 'slack_api_error' + + +class Recipient + attr_reader :slack_id, :name + # SLACK_TOKEN = ENV['SLACK_TOKEN'] + def initialize(slack_id:, name:) + @slack_id = slack_id + @name = name + end + # methods + + def send_message(message, emoji: "", send_as: "") + # as recommended by Slack API for slack apps + if message.length > 4000 # message too long + # we don't want to break the program unless the API can't connect + # so we do a puts + raise SlackApiError, "Message too long. Try again." + return false + end + url = 'https://slack.com/api/chat.postMessage' + query = { token: Recipient.token, + text: message, + channel: @slack_id, + icon_emoji: emoji, + username: send_as} # to post to both users and channel + sleep(1) + response = HTTParty.post(url, query: query) + + # check for successful post + unless response.parsed_response['ok'] && response.code == 200 + # we don't want to break the program here because the reason + # could be anything + raise SlackApiError, "Error: #{response.parsed_response['error']}. Please try again" + return false + end + + return response.parsed_response + end + + def self.token + return ENV['SLACK_TOKEN'] + end + # we are assuming, because the CLI user won't see the code and only the program + # itself uses it, that the url is a valid url. + def self.get(url, params) + response = HTTParty.get(url, query: params) + sleep(0.5) + if response.code != 200 || !response.parsed_response['ok'] + raise SlackApiError, "Error: #{response.parsed_response['error']}. Please try again" + end + return response + end + + # template methods + def details + raise NotImplementedError, "implement me in child class" + end + + def self.list_all + raise NotImplementedError, "implement me in child class" + end +end diff --git a/lib/slack.rb b/lib/slack.rb index 8a0b659b..b9ab165a 100755 --- a/lib/slack.rb +++ b/lib/slack.rb @@ -1,12 +1,118 @@ #!/usr/bin/env ruby +require_relative 'workspace' +require 'table_print' +require 'dotenv' +require 'csv' +require 'awesome_print' + +def save_message_history(message, recipient) + CSV.open("message_history.csv", "a") do |file| + file << [recipient.name, recipient.slack_id, message] + end +end + +def get_message_history(selected) + history = CSV.read('message_history.csv').map { |row| row.to_a } + selected_recipients = history.select { |recipient| recipient[0] == selected.name || recipient[1] == selected.slack_id} + messages = selected_recipients.map{ |recipient_arr| recipient_arr[2]} + return messages +end def main + Dotenv.load puts "Welcome to the Ada Slack CLI!" workspace = Workspace.new + bot = workspace.current_bot + selected_recipient = nil + selected_emoji = nil + selected_username = nil + history_file = false + + puts + puts "This workspace has #{workspace.users.length} users and #{workspace.channels.length} channels" + puts + puts "Choose from the following \n 1. list channels \n 2. list users \n 3. select user \n 4. select channel \n 5. details \n 6. send message \n 7. clear selection \n 8. message history \n 9. set emoji and username \n 10. quit \nSelected Recipient(NONE if blank): #{selected_recipient} \nSelected Emoji(NONE if blank and only for current bot): #{selected_emoji} \nSelected Username(NONE if blank and only for current bot): #{selected_username}" + puts + + user_input = "" + until user_input == "quit" + puts "What would you like to do?" + user_input = gets.strip.downcase + + case user_input + when "list channels" + tp workspace.channels, :slack_id, :name, :topic, :member_count + when "list users" + tp workspace.users, :slack_id, :name, :real_name, :time_zone, :is_bot + when "select user" + puts "Which user would you like to select?" + selected_recipient = gets.strip + workspace.select_user(selected_recipient) + if workspace.selected.nil? + puts "No user by the name #{selected_recipient} can be found. Please try again." + end + when "select channel" + puts "Which channel would you like to select?" + selected_recipient = gets.strip + workspace.select_channel(selected_recipient) + if workspace.selected.nil? + puts "No channel by the name #{selected_recipient} can be found. Please try again." + end + when "details" + if workspace.selected.nil? + puts "Please select a channel or user before asking for details." + end + workspace.show_details + when "send message" + if workspace.selected.nil? + puts "Please select a channel or user before sending a message." + else + puts "What is the message you would like to send?" + message = gets.strip + begin + workspace.send_message(message) + save_message_history(message, workspace.selected) + rescue SlackApiError => error + puts error.message + end + history_file = true + end + when "clear selection" + workspace.clear_selection + selected_recipient = nil + when "quit" + user_input = "quit" + break + when "message history" + if workspace.selected.nil? + puts "Please select a channel or user before sending a message." + elsif !history_file + puts "No messages sent yet." + else + message_history = get_message_history(workspace.selected) + ap message_history + end + when "set emoji and username" + puts "Which emoji would you like to add?" + emoji = gets.strip + selected_emoji = emoji + begin + bot.set_emoji(emoji) + rescue ArgumentError => error + puts error.message + end + puts "What would you like to set the username of the bot as?" + username = gets.strip + selected_username = username + bot.set_send_as(username) + else + puts "That's not a valid option. Please try again." + end - # TODO project + puts "Choose from the following: \n 1. list channels \n 2. list users \n 3. select user \n 4. select channel \n 5. details \n 6. send message \n 7. clear selection \n 8. message history \n 9. set emoji and username \n 10. quit \nSelected Recipient(NONE if blank): #{selected_recipient} \nSelected Emoji(NONE if blank and only for current bot): #{selected_emoji} \nSelected Username(NONE if blank and only for current bot): #{selected_username}" + end - puts "Thank you for using the Ada Slack CLI" + puts "Thank you for using the Ada Slack CLI!" end main if __FILE__ == $PROGRAM_NAME \ No newline at end of file diff --git a/lib/slack_api_error.rb b/lib/slack_api_error.rb new file mode 100644 index 00000000..885e2243 --- /dev/null +++ b/lib/slack_api_error.rb @@ -0,0 +1,3 @@ +class SlackApiError < StandardError + +end \ No newline at end of file diff --git a/lib/user.rb b/lib/user.rb new file mode 100644 index 00000000..cf8a3fff --- /dev/null +++ b/lib/user.rb @@ -0,0 +1,42 @@ +require_relative 'recipient' +require 'table_print' + +class User < Recipient + + attr_reader :real_name, :time_zone, :is_bot + + def initialize(slack_id:, name:, real_name:, time_zone: "Pacific Daylight Time", is_bot: false) + super(slack_id: slack_id,name: name) + @real_name = real_name + @time_zone = time_zone + @is_bot = is_bot + end + + # reader methods + def details + tp self, :slack_id, :name, :real_name, :time_zone, :is_bot + return {"SLACK_ID": @slack_id, + "NAME": @name, + "REAL_NAME": @real_name, + "TIME_ZONE": @time_zone, + "IS_BOT": @is_bot + } + end + + # class methods + def self.list_all + url = 'https://slack.com/api/users.list' + param = {token: User.token} + raw_users = User.get(url, param)['members'] + all_users = [] # to skip over deleted users + raw_users.each do |member| + next if member['deleted'] + all_users << User.new(slack_id: member['id'], + name: member['name'], + real_name: member['real_name'], + time_zone: member['tz_label'], + is_bot: member['is_bot']) + end + return all_users + end +end \ No newline at end of file diff --git a/lib/workspace.rb b/lib/workspace.rb new file mode 100644 index 00000000..9e607bbe --- /dev/null +++ b/lib/workspace.rb @@ -0,0 +1,70 @@ +# frozen_string_literal: true + +require_relative 'user' +require_relative 'recipient' +require_relative 'channel' +require_relative 'bot' + +class Workspace + attr_reader :users, :channels, :selected, :current_bot + + def initialize + @users = User.list_all + @channels = Channel.list_all + @selected = nil + @current_bot = Bot.current_bot + end + + def select_channel(channel_info) + unless channel_info.nil? + channel_s = channel_info.to_s + @channels.each do |channel| + if channel.slack_id == channel_s || channel.name == channel_s + @selected = channel + return channel_info + end + end + end + return + end + + def select_user(user_info) + unless user_info.nil? # to use nil to reset selected field + user_s = user_info.to_s # in case a string isn't input + @users.each do |user| + # matches to slack_id or name (NOT real_name) + # returns input if successfully changed + if user.slack_id == user_s || user.name == user_s + @selected = user + return user_info + end + if @current_bot.slack_id == user_s || @current_bot.name == user_s + @selected = @current_bot + return user_info + end + end + end + return nil # returns nil to indicate user not found + end + + # clear selected field + def clear_selection + @selected = nil + end + + def send_message(message) + # returns nil if nothing is selected (sanity check) + # prints boolean from Recipient.send_message + return nil if @selected.nil? + # the driver will reset recipient if true + # otherwise will not reset until valid message + return @selected.send_message(message, emoji: @current_bot.emoji, send_as: @current_bot.send_as) # the driver will reset recipient if true + end + + def show_details + # returns nil if nothing is selected (sanity check) + # returns respective details for selected user or channel otherwise + return @selected.nil? ? nil : @selected.details + end + +end diff --git a/message_history.csv b/message_history.csv new file mode 100644 index 00000000..8ef119e1 --- /dev/null +++ b/message_history.csv @@ -0,0 +1 @@ +pauline.chane,U01BKP7MGVD,yay diff --git a/test/bot_test.rb b/test/bot_test.rb new file mode 100644 index 00000000..36de3499 --- /dev/null +++ b/test/bot_test.rb @@ -0,0 +1,61 @@ +require_relative 'test_helper' + +describe Bot do + before do + @bot = Bot.new(slack_id: "USLACKBOT", name: "slackbot", real_name: "Slackbot", time_zone: "Pacific Daylight Time", is_bot: true, send_as: "Bork", emoji: "dog") + end + + describe "constructor" do + it "creates an instance of bot with appropriate fields" do + expect(@bot).must_be_instance_of Bot + expect(@bot).must_be_kind_of User + expect(@bot.slack_id).must_equal "USLACKBOT" + expect(@bot.name).must_equal "slackbot" + expect(@bot.real_name).must_equal "Slackbot" + expect(@bot.time_zone).must_equal "Pacific Daylight Time" + expect(@bot.is_bot).must_equal true + expect(@bot.send_as).must_equal "Bork" + expect(@bot.emoji).must_equal "dog" + end + end + describe 'set_send_as' do + it "sets name to user provided alias" do + expect(@bot.set_send_as("Bork")).must_equal "Bork" + end + end + describe 'set_emoji' do + it "sets the emoji based on the provided emoji" do + expect(@bot.set_emoji("dog")).must_equal "dog" + end + it "raises an error when the emoji is invalid format" do + expect do + @bot.set_emoji("??????") + end.must_raise ArgumentError + end + end + describe "self.list_all" do + it "returns all users in the workspace" do + VCR.use_cassette("bot list_all") do + # Arrange + BOTS_URL = "https://slack.com/api/users.list" + # SLACK_TOKEN = ENV["SLACK_TOKEN"] + response = HTTParty.get(BOTS_URL, query: {token: Bot.token})["members"] + # account for slackbot and deleted members + response = response.filter{ |member| (!member["deleted"] && member["is_bot"])|| member["id"] == "USLACKBOT"} # remove deleted members + # Act + bots = Bot.list_all + + # Assert + expect(bots.length).must_equal response.length + response.length.times do |i| + expect(response[i]["id"]).must_equal bots[i].slack_id + expect(response[i]["name"]).must_equal bots[i].name + expect(response[i]["real_name"]).must_equal bots[i].real_name + expect(response[i]["tz_label"]).must_equal bots[i].time_zone + expect(response[i]["is_bot"]).must_equal bots[i].is_bot + end + end + end + end +end + diff --git a/test/cassettes/Recipient_get.yml b/test/cassettes/Recipient_get.yml new file mode 100644 index 00000000..2e151b4d --- /dev/null +++ b/test/cassettes/Recipient_get.yml @@ -0,0 +1,178 @@ +--- +http_interactions: +- request: + method: get + uri: https://slack.com/api/conversations.list?token=blah + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 08 Oct 2020 03:04:52 GMT + Server: + - Apache + X-Slack-Req-Id: + - 97eba3a9672fced144b9625e70b337ef + Referrer-Policy: + - no-referrer + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + X-Slack-Backend: + - r + Access-Control-Allow-Origin: + - "*" + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - '0' + Content-Length: + - '55' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-k2o1,haproxy-edge-pdx-f5k6 + body: + encoding: ASCII-8BIT + string: '{"ok":false,"error":"invalid_auth"}' + recorded_at: Thu, 08 Oct 2020 03:04:52 GMT +- request: + method: get + uri: https://slack.com/api/monkeys?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 08 Oct 2020 03:04:52 GMT + Server: + - Apache + X-Slack-Req-Id: + - e24d4b53e7aaabae8c07fbc2d6192260 + Referrer-Policy: + - no-referrer + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + X-Slack-Backend: + - r + Access-Control-Allow-Origin: + - "*" + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - '0' + Content-Length: + - '73' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-td7e,haproxy-edge-pdx-dhzt + body: + encoding: ASCII-8BIT + string: '{"ok":false,"error":"unknown_method","req_method":"monkeys"}' + recorded_at: Thu, 08 Oct 2020 03:04:52 GMT +- request: + method: get + uri: https://slack.com/api/conversations.list?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 08 Oct 2020 03:04:53 GMT + Server: + - Apache + X-Slack-Req-Id: + - fe500907d342be65fba7cd417b835449 + X-Oauth-Scopes: + - users:read,channels:read,chat:write,incoming-webhook + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Origin: + - "*" + X-Slack-Backend: + - r + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - channels:read,groups:read,mpim:read,im:read,read + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Content-Length: + - '719' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-g9mv,haproxy-edge-pdx-1x0h + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channels":[{"id":"C01BKP7MWNB","name":"random","is_channel":true,"is_group":false,"is_im":false,"created":1601939539,"is_archived":false,"is_general":false,"unlinked":0,"name_normalized":"random","is_shared":false,"parent_conversation":null,"creator":"U01BKP7MGVD","is_ext_shared":false,"is_org_shared":false,"shared_team_ids":["T01C6M7N136"],"pending_shared":[],"pending_connected_team_ids":[],"is_pending_ext_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"This + channel is for... well, everything else. It\u2019s a place for team jokes, + spur-of-the-moment ideas, and funny GIFs. Go wild!","creator":"U01BKP7MGVD","last_set":1601939539},"previous_names":[],"num_members":4},{"id":"C01BKP8MF2T","name":"ada-c14-slack-cli-project","is_channel":true,"is_group":false,"is_im":false,"created":1601939581,"is_archived":false,"is_general":false,"unlinked":0,"name_normalized":"ada-c14-slack-cli-project","is_shared":false,"parent_conversation":null,"creator":"U01BKP7MGVD","is_ext_shared":false,"is_org_shared":false,"shared_team_ids":["T01C6M7N136"],"pending_shared":[],"pending_connected_team_ids":[],"is_pending_ext_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"This + *channel* is for working on a project. Hold meetings, share docs, and make + decisions together with your team.","creator":"U01BKP7MGVD","last_set":1601939581},"previous_names":[],"num_members":3},{"id":"C01C0MP03K5","name":"general","is_channel":true,"is_group":false,"is_im":false,"created":1601939538,"is_archived":false,"is_general":true,"unlinked":0,"name_normalized":"general","is_shared":false,"parent_conversation":null,"creator":"U01BKP7MGVD","is_ext_shared":false,"is_org_shared":false,"shared_team_ids":["T01C6M7N136"],"pending_shared":[],"pending_connected_team_ids":[],"is_pending_ext_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"This + is the one channel that will always include everyone. It\u2019s a great spot + for announcements and team-wide conversations.","creator":"U01BKP7MGVD","last_set":1601939538},"previous_names":[],"num_members":4},{"id":"C01C6J4TD7D","name":"do-not-add-bots","is_channel":true,"is_group":false,"is_im":false,"created":1602117099,"is_archived":false,"is_general":false,"unlinked":0,"name_normalized":"do-not-add-bots","is_shared":false,"parent_conversation":null,"creator":"U01BKP7MGVD","is_ext_shared":false,"is_org_shared":false,"shared_team_ids":["T01C6M7N136"],"pending_shared":[],"pending_connected_team_ids":[],"is_pending_ext_shared":false,"is_member":false,"is_private":false,"is_mpim":false,"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"debugging","creator":"U01BKP7MGVD","last_set":1602117099},"previous_names":[],"num_members":2}],"response_metadata":{"next_cursor":""}}' + recorded_at: Thu, 08 Oct 2020 03:04:53 GMT +recorded_with: VCR 6.0.0 diff --git a/test/cassettes/Workspace_send_message.yml b/test/cassettes/Workspace_send_message.yml new file mode 100644 index 00000000..57fa61c0 --- /dev/null +++ b/test/cassettes/Workspace_send_message.yml @@ -0,0 +1,323 @@ +--- +http_interactions: +- request: + method: post + uri: https://slack.com/api/chat.postMessage?channel=USLACKBOT&text=HEY%20LISTEN&token= + body: + encoding: UTF-8 + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 08 Oct 2020 19:18:08 GMT + Server: + - Apache + X-Slack-Req-Id: + - f919dc97d5ba09e1ee2c93c458f2093b + X-Oauth-Scopes: + - users:read,channels:read,chat:write,incoming-webhook,groups:read,im:read,mpim:read,chat:write.customize + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Origin: + - "*" + X-Slack-Backend: + - r + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - chat:write + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Content-Length: + - '340' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-9rc7,haproxy-edge-pdx-ggfr + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channel":"D01CSQTE4QG","ts":"1602184688.000200","message":{"bot_id":"B01C94S0PMJ","type":"message","text":"HEY + LISTEN","user":"U01BW7XP2KY","ts":"1602184688.000200","team":"T01C6M7N136","bot_profile":{"id":"B01C94S0PMJ","deleted":false,"name":"Fire + - Pauline - Slack CLI","updated":1602014193,"app_id":"A01BZS74GDB","icons":{"image_36":"https:\/\/a.slack-edge.com\/80588\/img\/plugins\/app\/bot_36.png","image_48":"https:\/\/a.slack-edge.com\/80588\/img\/plugins\/app\/bot_48.png","image_72":"https:\/\/a.slack-edge.com\/80588\/img\/plugins\/app\/service_72.png"},"team_id":"T01C6M7N136"}}}' + recorded_at: Thu, 08 Oct 2020 19:18:08 GMT +- request: + method: get + uri: https://slack.com/api/conversations.members?channel=D01CSQTE4QG&token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 08 Oct 2020 19:18:09 GMT + Server: + - Apache + X-Slack-Req-Id: + - 07a97f31375d4fc2b27a0961bca1abb5 + X-Oauth-Scopes: + - users:read,channels:read,chat:write,incoming-webhook,groups:read,im:read,mpim:read,chat:write.customize + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Origin: + - "*" + X-Slack-Backend: + - r + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - channels:read,groups:read,mpim:read,im:read,read + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Content-Length: + - '106' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-572o,haproxy-edge-pdx-rgh8 + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":["U01BW7XP2KY","USLACKBOT"],"response_metadata":{"next_cursor":""}}' + recorded_at: Thu, 08 Oct 2020 19:18:09 GMT +- request: + method: post + uri: https://slack.com/api/chat.postMessage?channel=USLACKBOT&emoji=&send_as=&text=HEY%20LISTEN&token= + body: + encoding: UTF-8 + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 09 Oct 2020 03:35:08 GMT + Server: + - Apache + X-Slack-Req-Id: + - 51af7b217eb56a1dafe0b7f33152c8ad + X-Oauth-Scopes: + - users:read,channels:read,chat:write,incoming-webhook,groups:read,im:read,mpim:read,chat:write.customize + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Origin: + - "*" + X-Slack-Backend: + - r + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - chat:write + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Content-Length: + - '340' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-wtop,haproxy-edge-pdx-sqqp + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channel":"D01CSQTE4QG","ts":"1602214508.000100","message":{"bot_id":"B01C94S0PMJ","type":"message","text":"HEY + LISTEN","user":"U01BW7XP2KY","ts":"1602214508.000100","team":"T01C6M7N136","bot_profile":{"id":"B01C94S0PMJ","deleted":false,"name":"Fire + - Pauline - Slack CLI","updated":1602014193,"app_id":"A01BZS74GDB","icons":{"image_36":"https:\/\/a.slack-edge.com\/80588\/img\/plugins\/app\/bot_36.png","image_48":"https:\/\/a.slack-edge.com\/80588\/img\/plugins\/app\/bot_48.png","image_72":"https:\/\/a.slack-edge.com\/80588\/img\/plugins\/app\/service_72.png"},"team_id":"T01C6M7N136"}}}' + recorded_at: Fri, 09 Oct 2020 03:35:08 GMT +- request: + method: post + uri: https://slack.com/api/chat.postMessage?channel=USLACKBOT&icon_emoji=&text=HEY%20LISTEN&token=&username= + body: + encoding: UTF-8 + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 09 Oct 2020 17:10:31 GMT + Server: + - Apache + X-Slack-Req-Id: + - 221f71cdae65cc5ea138601a0eb29c96 + X-Oauth-Scopes: + - users:read,channels:read,chat:write,incoming-webhook,groups:read,im:read,mpim:read,chat:write.customize + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Origin: + - "*" + X-Slack-Backend: + - r + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - chat:write + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Content-Length: + - '179' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-m88x,haproxy-edge-pdx-cre0 + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channel":"D01BUMDABT9","ts":"1602263431.000100","message":{"type":"message","subtype":"bot_message","text":"HEY + LISTEN","ts":"1602263431.000100","username":"Fire - Pauline - Slack CLI","bot_id":"B01C94S0PMJ"}}' + recorded_at: Fri, 09 Oct 2020 17:10:31 GMT +- request: + method: get + uri: https://slack.com/api/conversations.members?channel=D01BUMDABT9&token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 09 Oct 2020 17:10:31 GMT + Server: + - Apache + X-Slack-Req-Id: + - 74b9e9f3ac4bc6849c71db10a1340db8 + X-Oauth-Scopes: + - users:read,channels:read,chat:write,incoming-webhook,groups:read,im:read,mpim:read,chat:write.customize + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Origin: + - "*" + X-Slack-Backend: + - r + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - channels:read,groups:read,mpim:read,im:read,read + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Content-Length: + - '60' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-w9x0,haproxy-edge-pdx-ttqn + body: + encoding: ASCII-8BIT + string: '{"ok":false,"error":"channel_not_found"}' + recorded_at: Fri, 09 Oct 2020 17:10:31 GMT +recorded_with: VCR 6.0.0 diff --git a/test/cassettes/bot_list_all.yml b/test/cassettes/bot_list_all.yml new file mode 100644 index 00000000..5ee09908 --- /dev/null +++ b/test/cassettes/bot_list_all.yml @@ -0,0 +1,153 @@ +--- +http_interactions: +- request: + method: get + uri: https://slack.com/api/users.list?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 09 Oct 2020 01:33:49 GMT + Server: + - Apache + X-Slack-Req-Id: + - a5399da840de89f8388ec9872bf61f83 + X-Oauth-Scopes: + - users:read,channels:read,chat:write,incoming-webhook,groups:read,im:read,mpim:read,chat:write.customize + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Origin: + - "*" + X-Slack-Backend: + - r + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - users:read + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Content-Length: + - '1416' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-77pk,haproxy-edge-pdx-ggfr + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"T01C6M7N136","name":"slackbot","deleted":false,"color":"757575","real_name":"Slackbot","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Slackbot","real_name_normalized":"Slackbot","display_name":"Slackbot","display_name_normalized":"Slackbot","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"sv41d8cd98f0","always_active":true,"first_name":"slackbot","last_name":"","image_24":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_24.png","image_32":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_32.png","image_48":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_48.png","image_72":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_72.png","image_192":"https:\/\/a.slack-edge.com\/80588\/marketing\/img\/avatars\/slackbot\/avatar-slackbot.png","image_512":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":0},{"id":"U01BKP7MGVD","team_id":"T01C6M7N136","name":"pauline.chane","deleted":false,"color":"9f69e7","real_name":"pauline.chane","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"pauline.chane","real_name_normalized":"pauline.chane","display_name":"","display_name_normalized":"","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gac6154e1c22","image_24":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":true,"is_owner":true,"is_primary_owner":true,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1602140346},{"id":"U01BW7XP2KY","team_id":"T01C6M7N136","name":"fire_pauline_slack_cl","deleted":false,"color":"e7392d","real_name":"Fire + - Pauline - Slack CLI","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight + Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Fire + - Pauline - Slack CLI","real_name_normalized":"Fire - Pauline - Slack CLI","display_name":"","display_name_normalized":"","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gd69838ab849","api_app_id":"A01BZS74GDB","always_active":false,"bot_id":"B01C94S0PMJ","image_24":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":true,"is_app_user":false,"updated":1602014193},{"id":"U01BXCZPJBF","team_id":"T01C6M7N136","name":"rpatel01","deleted":false,"color":"4bbe2e","real_name":"Roshni + Patel","tz":"America\/Chicago","tz_label":"Central Daylight Time","tz_offset":-18000,"profile":{"title":"","phone":"","skype":"","real_name":"Roshni + Patel","real_name_normalized":"Roshni Patel","display_name":"roshni.patel","display_name_normalized":"roshni.patel","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g06d8eb9fe76","first_name":"Roshni","last_name":"Patel","image_24":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":true,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1602115573},{"id":"U01C33TL48J","team_id":"T01C6M7N136","name":"fire_roshni_api_pro2","deleted":false,"color":"674b1b","real_name":"Fire + - Roshni - API Project","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight + Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Fire + - Roshni - API Project","real_name_normalized":"Fire - Roshni - API Project","display_name":"","display_name_normalized":"","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g4bff6015394","api_app_id":"A01C98GFT5J","always_active":false,"bot_id":"B01BWBQTUEA","image_24":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":true,"is_app_user":false,"updated":1602017351},{"id":"U01CFJST9SM","team_id":"T01C6M7N136","name":"fire_roshni_api_proje","deleted":true,"profile":{"title":"","phone":"","skype":"","real_name":"Fire + - Roshni - API Project","real_name_normalized":"Fire - Roshni - API Project","display_name":"","display_name_normalized":"","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g0a5c0c0a39c","api_app_id":"A01CSQSKQE4","always_active":false,"bot_id":"B01CSR2C56U","first_name":"Fire","last_name":"- + Roshni - API Project","image_24":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_bot":true,"is_app_user":false,"updated":1602017279}],"cache_ts":1602207229,"response_metadata":{"next_cursor":""}}' + recorded_at: Fri, 09 Oct 2020 01:33:49 GMT +- request: + method: get + uri: https://slack.com/api/users.list?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 09 Oct 2020 01:33:50 GMT + Server: + - Apache + X-Slack-Req-Id: + - 5d5d81f19e8571ca0da5118e6907bbd5 + X-Oauth-Scopes: + - users:read,channels:read,chat:write,incoming-webhook,groups:read,im:read,mpim:read,chat:write.customize + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Origin: + - "*" + X-Slack-Backend: + - r + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - users:read + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Content-Length: + - '1416' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-jtpc,haproxy-edge-pdx-vs95 + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"T01C6M7N136","name":"slackbot","deleted":false,"color":"757575","real_name":"Slackbot","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Slackbot","real_name_normalized":"Slackbot","display_name":"Slackbot","display_name_normalized":"Slackbot","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"sv41d8cd98f0","always_active":true,"first_name":"slackbot","last_name":"","image_24":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_24.png","image_32":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_32.png","image_48":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_48.png","image_72":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_72.png","image_192":"https:\/\/a.slack-edge.com\/80588\/marketing\/img\/avatars\/slackbot\/avatar-slackbot.png","image_512":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":0},{"id":"U01BKP7MGVD","team_id":"T01C6M7N136","name":"pauline.chane","deleted":false,"color":"9f69e7","real_name":"pauline.chane","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"pauline.chane","real_name_normalized":"pauline.chane","display_name":"","display_name_normalized":"","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gac6154e1c22","image_24":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":true,"is_owner":true,"is_primary_owner":true,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1602140346},{"id":"U01BW7XP2KY","team_id":"T01C6M7N136","name":"fire_pauline_slack_cl","deleted":false,"color":"e7392d","real_name":"Fire + - Pauline - Slack CLI","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight + Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Fire + - Pauline - Slack CLI","real_name_normalized":"Fire - Pauline - Slack CLI","display_name":"","display_name_normalized":"","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gd69838ab849","api_app_id":"A01BZS74GDB","always_active":false,"bot_id":"B01C94S0PMJ","image_24":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":true,"is_app_user":false,"updated":1602014193},{"id":"U01BXCZPJBF","team_id":"T01C6M7N136","name":"rpatel01","deleted":false,"color":"4bbe2e","real_name":"Roshni + Patel","tz":"America\/Chicago","tz_label":"Central Daylight Time","tz_offset":-18000,"profile":{"title":"","phone":"","skype":"","real_name":"Roshni + Patel","real_name_normalized":"Roshni Patel","display_name":"roshni.patel","display_name_normalized":"roshni.patel","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g06d8eb9fe76","first_name":"Roshni","last_name":"Patel","image_24":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":true,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1602115573},{"id":"U01C33TL48J","team_id":"T01C6M7N136","name":"fire_roshni_api_pro2","deleted":false,"color":"674b1b","real_name":"Fire + - Roshni - API Project","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight + Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Fire + - Roshni - API Project","real_name_normalized":"Fire - Roshni - API Project","display_name":"","display_name_normalized":"","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g4bff6015394","api_app_id":"A01C98GFT5J","always_active":false,"bot_id":"B01BWBQTUEA","image_24":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":true,"is_app_user":false,"updated":1602017351},{"id":"U01CFJST9SM","team_id":"T01C6M7N136","name":"fire_roshni_api_proje","deleted":true,"profile":{"title":"","phone":"","skype":"","real_name":"Fire + - Roshni - API Project","real_name_normalized":"Fire - Roshni - API Project","display_name":"","display_name_normalized":"","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g0a5c0c0a39c","api_app_id":"A01CSQSKQE4","always_active":false,"bot_id":"B01CSR2C56U","first_name":"Fire","last_name":"- + Roshni - API Project","image_24":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_bot":true,"is_app_user":false,"updated":1602017279}],"cache_ts":1602207230,"response_metadata":{"next_cursor":""}}' + recorded_at: Fri, 09 Oct 2020 01:33:50 GMT +recorded_with: VCR 6.0.0 diff --git a/test/cassettes/list_all.yml b/test/cassettes/list_all.yml new file mode 100644 index 00000000..4cd89680 --- /dev/null +++ b/test/cassettes/list_all.yml @@ -0,0 +1,438 @@ +--- +http_interactions: +- request: + method: get + uri: https://slack.com/api/conversations.list?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 08 Oct 2020 03:04:43 GMT + Server: + - Apache + X-Slack-Req-Id: + - 7a1dada93f49f9b80c787d3eae082ae3 + X-Oauth-Scopes: + - users:read,channels:read,chat:write,incoming-webhook + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Origin: + - "*" + X-Slack-Backend: + - r + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - channels:read,groups:read,mpim:read,im:read,read + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Content-Length: + - '719' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-wmb9,haproxy-edge-pdx-68eo + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channels":[{"id":"C01BKP7MWNB","name":"random","is_channel":true,"is_group":false,"is_im":false,"created":1601939539,"is_archived":false,"is_general":false,"unlinked":0,"name_normalized":"random","is_shared":false,"parent_conversation":null,"creator":"U01BKP7MGVD","is_ext_shared":false,"is_org_shared":false,"shared_team_ids":["T01C6M7N136"],"pending_shared":[],"pending_connected_team_ids":[],"is_pending_ext_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"This + channel is for... well, everything else. It\u2019s a place for team jokes, + spur-of-the-moment ideas, and funny GIFs. Go wild!","creator":"U01BKP7MGVD","last_set":1601939539},"previous_names":[],"num_members":4},{"id":"C01BKP8MF2T","name":"ada-c14-slack-cli-project","is_channel":true,"is_group":false,"is_im":false,"created":1601939581,"is_archived":false,"is_general":false,"unlinked":0,"name_normalized":"ada-c14-slack-cli-project","is_shared":false,"parent_conversation":null,"creator":"U01BKP7MGVD","is_ext_shared":false,"is_org_shared":false,"shared_team_ids":["T01C6M7N136"],"pending_shared":[],"pending_connected_team_ids":[],"is_pending_ext_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"This + *channel* is for working on a project. Hold meetings, share docs, and make + decisions together with your team.","creator":"U01BKP7MGVD","last_set":1601939581},"previous_names":[],"num_members":3},{"id":"C01C0MP03K5","name":"general","is_channel":true,"is_group":false,"is_im":false,"created":1601939538,"is_archived":false,"is_general":true,"unlinked":0,"name_normalized":"general","is_shared":false,"parent_conversation":null,"creator":"U01BKP7MGVD","is_ext_shared":false,"is_org_shared":false,"shared_team_ids":["T01C6M7N136"],"pending_shared":[],"pending_connected_team_ids":[],"is_pending_ext_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"This + is the one channel that will always include everyone. It\u2019s a great spot + for announcements and team-wide conversations.","creator":"U01BKP7MGVD","last_set":1601939538},"previous_names":[],"num_members":4},{"id":"C01C6J4TD7D","name":"do-not-add-bots","is_channel":true,"is_group":false,"is_im":false,"created":1602117099,"is_archived":false,"is_general":false,"unlinked":0,"name_normalized":"do-not-add-bots","is_shared":false,"parent_conversation":null,"creator":"U01BKP7MGVD","is_ext_shared":false,"is_org_shared":false,"shared_team_ids":["T01C6M7N136"],"pending_shared":[],"pending_connected_team_ids":[],"is_pending_ext_shared":false,"is_member":false,"is_private":false,"is_mpim":false,"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"debugging","creator":"U01BKP7MGVD","last_set":1602117099},"previous_names":[],"num_members":2}],"response_metadata":{"next_cursor":""}}' + recorded_at: Thu, 08 Oct 2020 03:04:43 GMT +- request: + method: get + uri: https://slack.com/api/conversations.list?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 08 Oct 2020 03:04:43 GMT + Server: + - Apache + X-Slack-Req-Id: + - 69e6187da506b22420f8ad5c0fa2bb8d + X-Oauth-Scopes: + - users:read,channels:read,chat:write,incoming-webhook + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Origin: + - "*" + X-Slack-Backend: + - r + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - channels:read,groups:read,mpim:read,im:read,read + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Content-Length: + - '719' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-91vl,haproxy-edge-pdx-uln4 + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channels":[{"id":"C01BKP7MWNB","name":"random","is_channel":true,"is_group":false,"is_im":false,"created":1601939539,"is_archived":false,"is_general":false,"unlinked":0,"name_normalized":"random","is_shared":false,"parent_conversation":null,"creator":"U01BKP7MGVD","is_ext_shared":false,"is_org_shared":false,"shared_team_ids":["T01C6M7N136"],"pending_shared":[],"pending_connected_team_ids":[],"is_pending_ext_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"This + channel is for... well, everything else. It\u2019s a place for team jokes, + spur-of-the-moment ideas, and funny GIFs. Go wild!","creator":"U01BKP7MGVD","last_set":1601939539},"previous_names":[],"num_members":4},{"id":"C01BKP8MF2T","name":"ada-c14-slack-cli-project","is_channel":true,"is_group":false,"is_im":false,"created":1601939581,"is_archived":false,"is_general":false,"unlinked":0,"name_normalized":"ada-c14-slack-cli-project","is_shared":false,"parent_conversation":null,"creator":"U01BKP7MGVD","is_ext_shared":false,"is_org_shared":false,"shared_team_ids":["T01C6M7N136"],"pending_shared":[],"pending_connected_team_ids":[],"is_pending_ext_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"This + *channel* is for working on a project. Hold meetings, share docs, and make + decisions together with your team.","creator":"U01BKP7MGVD","last_set":1601939581},"previous_names":[],"num_members":3},{"id":"C01C0MP03K5","name":"general","is_channel":true,"is_group":false,"is_im":false,"created":1601939538,"is_archived":false,"is_general":true,"unlinked":0,"name_normalized":"general","is_shared":false,"parent_conversation":null,"creator":"U01BKP7MGVD","is_ext_shared":false,"is_org_shared":false,"shared_team_ids":["T01C6M7N136"],"pending_shared":[],"pending_connected_team_ids":[],"is_pending_ext_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"This + is the one channel that will always include everyone. It\u2019s a great spot + for announcements and team-wide conversations.","creator":"U01BKP7MGVD","last_set":1601939538},"previous_names":[],"num_members":4},{"id":"C01C6J4TD7D","name":"do-not-add-bots","is_channel":true,"is_group":false,"is_im":false,"created":1602117099,"is_archived":false,"is_general":false,"unlinked":0,"name_normalized":"do-not-add-bots","is_shared":false,"parent_conversation":null,"creator":"U01BKP7MGVD","is_ext_shared":false,"is_org_shared":false,"shared_team_ids":["T01C6M7N136"],"pending_shared":[],"pending_connected_team_ids":[],"is_pending_ext_shared":false,"is_member":false,"is_private":false,"is_mpim":false,"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"debugging","creator":"U01BKP7MGVD","last_set":1602117099},"previous_names":[],"num_members":2}],"response_metadata":{"next_cursor":""}}' + recorded_at: Thu, 08 Oct 2020 03:04:43 GMT +- request: + method: get + uri: https://slack.com/api/conversations.list?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 08 Oct 2020 03:04:44 GMT + Server: + - Apache + X-Slack-Req-Id: + - 82185115ec4b83869bf8cf69588bd0ab + X-Oauth-Scopes: + - users:read,channels:read,chat:write,incoming-webhook + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Origin: + - "*" + X-Slack-Backend: + - r + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - channels:read,groups:read,mpim:read,im:read,read + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Content-Length: + - '719' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-ellj,haproxy-edge-pdx-ylha + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channels":[{"id":"C01BKP7MWNB","name":"random","is_channel":true,"is_group":false,"is_im":false,"created":1601939539,"is_archived":false,"is_general":false,"unlinked":0,"name_normalized":"random","is_shared":false,"parent_conversation":null,"creator":"U01BKP7MGVD","is_ext_shared":false,"is_org_shared":false,"shared_team_ids":["T01C6M7N136"],"pending_shared":[],"pending_connected_team_ids":[],"is_pending_ext_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"This + channel is for... well, everything else. It\u2019s a place for team jokes, + spur-of-the-moment ideas, and funny GIFs. Go wild!","creator":"U01BKP7MGVD","last_set":1601939539},"previous_names":[],"num_members":4},{"id":"C01BKP8MF2T","name":"ada-c14-slack-cli-project","is_channel":true,"is_group":false,"is_im":false,"created":1601939581,"is_archived":false,"is_general":false,"unlinked":0,"name_normalized":"ada-c14-slack-cli-project","is_shared":false,"parent_conversation":null,"creator":"U01BKP7MGVD","is_ext_shared":false,"is_org_shared":false,"shared_team_ids":["T01C6M7N136"],"pending_shared":[],"pending_connected_team_ids":[],"is_pending_ext_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"This + *channel* is for working on a project. Hold meetings, share docs, and make + decisions together with your team.","creator":"U01BKP7MGVD","last_set":1601939581},"previous_names":[],"num_members":3},{"id":"C01C0MP03K5","name":"general","is_channel":true,"is_group":false,"is_im":false,"created":1601939538,"is_archived":false,"is_general":true,"unlinked":0,"name_normalized":"general","is_shared":false,"parent_conversation":null,"creator":"U01BKP7MGVD","is_ext_shared":false,"is_org_shared":false,"shared_team_ids":["T01C6M7N136"],"pending_shared":[],"pending_connected_team_ids":[],"is_pending_ext_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"This + is the one channel that will always include everyone. It\u2019s a great spot + for announcements and team-wide conversations.","creator":"U01BKP7MGVD","last_set":1601939538},"previous_names":[],"num_members":4},{"id":"C01C6J4TD7D","name":"do-not-add-bots","is_channel":true,"is_group":false,"is_im":false,"created":1602117099,"is_archived":false,"is_general":false,"unlinked":0,"name_normalized":"do-not-add-bots","is_shared":false,"parent_conversation":null,"creator":"U01BKP7MGVD","is_ext_shared":false,"is_org_shared":false,"shared_team_ids":["T01C6M7N136"],"pending_shared":[],"pending_connected_team_ids":[],"is_pending_ext_shared":false,"is_member":false,"is_private":false,"is_mpim":false,"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"debugging","creator":"U01BKP7MGVD","last_set":1602117099},"previous_names":[],"num_members":2}],"response_metadata":{"next_cursor":""}}' + recorded_at: Thu, 08 Oct 2020 03:04:44 GMT +- request: + method: get + uri: https://slack.com/api/users.list?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 08 Oct 2020 03:04:47 GMT + Server: + - Apache + X-Slack-Req-Id: + - 55e129c09da566ae2da8a998dcedb4a9 + X-Oauth-Scopes: + - users:read,channels:read,chat:write,incoming-webhook + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Origin: + - "*" + X-Slack-Backend: + - r + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - users:read + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Content-Length: + - '1448' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-invn,haproxy-edge-pdx-r6b3 + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"T01C6M7N136","name":"slackbot","deleted":false,"color":"757575","real_name":"Slackbot","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Slackbot","real_name_normalized":"Slackbot","display_name":"Slackbot","display_name_normalized":"Slackbot","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"sv41d8cd98f0","always_active":true,"first_name":"slackbot","last_name":"","image_24":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_24.png","image_32":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_32.png","image_48":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_48.png","image_72":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_72.png","image_192":"https:\/\/a.slack-edge.com\/80588\/marketing\/img\/avatars\/slackbot\/avatar-slackbot.png","image_512":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":0},{"id":"U01BKP7MGVD","team_id":"T01C6M7N136","name":"pauline.chane","deleted":false,"color":"9f69e7","real_name":"pauline.chane","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"pauline.chane","real_name_normalized":"pauline.chane","display_name":"","display_name_normalized":"","fields":null,"status_text":"HI + ROSHNI","status_emoji":":heart:","status_expiration":1602140399,"avatar_hash":"gac6154e1c22","image_24":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":true,"is_owner":true,"is_primary_owner":true,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1602119098},{"id":"U01BW7XP2KY","team_id":"T01C6M7N136","name":"fire_pauline_slack_cl","deleted":false,"color":"e7392d","real_name":"Fire + - Pauline - Slack CLI","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight + Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Fire + - Pauline - Slack CLI","real_name_normalized":"Fire - Pauline - Slack CLI","display_name":"","display_name_normalized":"","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gd69838ab849","api_app_id":"A01BZS74GDB","always_active":false,"bot_id":"B01C94S0PMJ","image_24":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":true,"is_app_user":false,"updated":1602014193},{"id":"U01BXCZPJBF","team_id":"T01C6M7N136","name":"rpatel01","deleted":false,"color":"4bbe2e","real_name":"Roshni + Patel","tz":"America\/Chicago","tz_label":"Central Daylight Time","tz_offset":-18000,"profile":{"title":"","phone":"","skype":"","real_name":"Roshni + Patel","real_name_normalized":"Roshni Patel","display_name":"roshni.patel","display_name_normalized":"roshni.patel","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g06d8eb9fe76","first_name":"Roshni","last_name":"Patel","image_24":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":true,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1602115573},{"id":"U01C33TL48J","team_id":"T01C6M7N136","name":"fire_roshni_api_pro2","deleted":false,"color":"674b1b","real_name":"Fire + - Roshni - API Project","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight + Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Fire + - Roshni - API Project","real_name_normalized":"Fire - Roshni - API Project","display_name":"","display_name_normalized":"","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g4bff6015394","api_app_id":"A01C98GFT5J","always_active":false,"bot_id":"B01BWBQTUEA","image_24":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":true,"is_app_user":false,"updated":1602017351},{"id":"U01CFJST9SM","team_id":"T01C6M7N136","name":"fire_roshni_api_proje","deleted":true,"profile":{"title":"","phone":"","skype":"","real_name":"Fire + - Roshni - API Project","real_name_normalized":"Fire - Roshni - API Project","display_name":"","display_name_normalized":"","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g0a5c0c0a39c","api_app_id":"A01CSQSKQE4","always_active":false,"bot_id":"B01CSR2C56U","first_name":"Fire","last_name":"- + Roshni - API Project","image_24":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_bot":true,"is_app_user":false,"updated":1602017279}],"cache_ts":1602126287,"response_metadata":{"next_cursor":""}}' + recorded_at: Thu, 08 Oct 2020 03:04:47 GMT +- request: + method: get + uri: https://slack.com/api/users.list?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 08 Oct 2020 03:04:47 GMT + Server: + - Apache + X-Slack-Req-Id: + - 4e53860d4546ca37c5d9e16b56ebe4bc + X-Oauth-Scopes: + - users:read,channels:read,chat:write,incoming-webhook + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Origin: + - "*" + X-Slack-Backend: + - r + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - users:read + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Content-Length: + - '1448' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-nkyk,haproxy-edge-pdx-0i42 + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"T01C6M7N136","name":"slackbot","deleted":false,"color":"757575","real_name":"Slackbot","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Slackbot","real_name_normalized":"Slackbot","display_name":"Slackbot","display_name_normalized":"Slackbot","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"sv41d8cd98f0","always_active":true,"first_name":"slackbot","last_name":"","image_24":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_24.png","image_32":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_32.png","image_48":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_48.png","image_72":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_72.png","image_192":"https:\/\/a.slack-edge.com\/80588\/marketing\/img\/avatars\/slackbot\/avatar-slackbot.png","image_512":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":0},{"id":"U01BKP7MGVD","team_id":"T01C6M7N136","name":"pauline.chane","deleted":false,"color":"9f69e7","real_name":"pauline.chane","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"pauline.chane","real_name_normalized":"pauline.chane","display_name":"","display_name_normalized":"","fields":null,"status_text":"HI + ROSHNI","status_emoji":":heart:","status_expiration":1602140399,"avatar_hash":"gac6154e1c22","image_24":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":true,"is_owner":true,"is_primary_owner":true,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1602119098},{"id":"U01BW7XP2KY","team_id":"T01C6M7N136","name":"fire_pauline_slack_cl","deleted":false,"color":"e7392d","real_name":"Fire + - Pauline - Slack CLI","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight + Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Fire + - Pauline - Slack CLI","real_name_normalized":"Fire - Pauline - Slack CLI","display_name":"","display_name_normalized":"","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gd69838ab849","api_app_id":"A01BZS74GDB","always_active":false,"bot_id":"B01C94S0PMJ","image_24":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":true,"is_app_user":false,"updated":1602014193},{"id":"U01BXCZPJBF","team_id":"T01C6M7N136","name":"rpatel01","deleted":false,"color":"4bbe2e","real_name":"Roshni + Patel","tz":"America\/Chicago","tz_label":"Central Daylight Time","tz_offset":-18000,"profile":{"title":"","phone":"","skype":"","real_name":"Roshni + Patel","real_name_normalized":"Roshni Patel","display_name":"roshni.patel","display_name_normalized":"roshni.patel","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g06d8eb9fe76","first_name":"Roshni","last_name":"Patel","image_24":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":true,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1602115573},{"id":"U01C33TL48J","team_id":"T01C6M7N136","name":"fire_roshni_api_pro2","deleted":false,"color":"674b1b","real_name":"Fire + - Roshni - API Project","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight + Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Fire + - Roshni - API Project","real_name_normalized":"Fire - Roshni - API Project","display_name":"","display_name_normalized":"","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g4bff6015394","api_app_id":"A01C98GFT5J","always_active":false,"bot_id":"B01BWBQTUEA","image_24":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":true,"is_app_user":false,"updated":1602017351},{"id":"U01CFJST9SM","team_id":"T01C6M7N136","name":"fire_roshni_api_proje","deleted":true,"profile":{"title":"","phone":"","skype":"","real_name":"Fire + - Roshni - API Project","real_name_normalized":"Fire - Roshni - API Project","display_name":"","display_name_normalized":"","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g0a5c0c0a39c","api_app_id":"A01CSQSKQE4","always_active":false,"bot_id":"B01CSR2C56U","first_name":"Fire","last_name":"- + Roshni - API Project","image_24":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_bot":true,"is_app_user":false,"updated":1602017279}],"cache_ts":1602126287,"response_metadata":{"next_cursor":""}}' + recorded_at: Thu, 08 Oct 2020 03:04:47 GMT +- request: + method: get + uri: https://slack.com/api/users.list?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 08 Oct 2020 03:04:48 GMT + Server: + - Apache + X-Slack-Req-Id: + - dc7ca48a902d14a6f26c3c9185dad726 + X-Oauth-Scopes: + - users:read,channels:read,chat:write,incoming-webhook + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Origin: + - "*" + X-Slack-Backend: + - r + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - users:read + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Content-Length: + - '1448' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-z1hq,haproxy-edge-pdx-vd1y + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"T01C6M7N136","name":"slackbot","deleted":false,"color":"757575","real_name":"Slackbot","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Slackbot","real_name_normalized":"Slackbot","display_name":"Slackbot","display_name_normalized":"Slackbot","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"sv41d8cd98f0","always_active":true,"first_name":"slackbot","last_name":"","image_24":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_24.png","image_32":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_32.png","image_48":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_48.png","image_72":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_72.png","image_192":"https:\/\/a.slack-edge.com\/80588\/marketing\/img\/avatars\/slackbot\/avatar-slackbot.png","image_512":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":0},{"id":"U01BKP7MGVD","team_id":"T01C6M7N136","name":"pauline.chane","deleted":false,"color":"9f69e7","real_name":"pauline.chane","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"pauline.chane","real_name_normalized":"pauline.chane","display_name":"","display_name_normalized":"","fields":null,"status_text":"HI + ROSHNI","status_emoji":":heart:","status_expiration":1602140399,"avatar_hash":"gac6154e1c22","image_24":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":true,"is_owner":true,"is_primary_owner":true,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1602119098},{"id":"U01BW7XP2KY","team_id":"T01C6M7N136","name":"fire_pauline_slack_cl","deleted":false,"color":"e7392d","real_name":"Fire + - Pauline - Slack CLI","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight + Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Fire + - Pauline - Slack CLI","real_name_normalized":"Fire - Pauline - Slack CLI","display_name":"","display_name_normalized":"","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gd69838ab849","api_app_id":"A01BZS74GDB","always_active":false,"bot_id":"B01C94S0PMJ","image_24":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":true,"is_app_user":false,"updated":1602014193},{"id":"U01BXCZPJBF","team_id":"T01C6M7N136","name":"rpatel01","deleted":false,"color":"4bbe2e","real_name":"Roshni + Patel","tz":"America\/Chicago","tz_label":"Central Daylight Time","tz_offset":-18000,"profile":{"title":"","phone":"","skype":"","real_name":"Roshni + Patel","real_name_normalized":"Roshni Patel","display_name":"roshni.patel","display_name_normalized":"roshni.patel","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g06d8eb9fe76","first_name":"Roshni","last_name":"Patel","image_24":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":true,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1602115573},{"id":"U01C33TL48J","team_id":"T01C6M7N136","name":"fire_roshni_api_pro2","deleted":false,"color":"674b1b","real_name":"Fire + - Roshni - API Project","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight + Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Fire + - Roshni - API Project","real_name_normalized":"Fire - Roshni - API Project","display_name":"","display_name_normalized":"","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g4bff6015394","api_app_id":"A01C98GFT5J","always_active":false,"bot_id":"B01BWBQTUEA","image_24":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":true,"is_app_user":false,"updated":1602017351},{"id":"U01CFJST9SM","team_id":"T01C6M7N136","name":"fire_roshni_api_proje","deleted":true,"profile":{"title":"","phone":"","skype":"","real_name":"Fire + - Roshni - API Project","real_name_normalized":"Fire - Roshni - API Project","display_name":"","display_name_normalized":"","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g0a5c0c0a39c","api_app_id":"A01CSQSKQE4","always_active":false,"bot_id":"B01CSR2C56U","first_name":"Fire","last_name":"- + Roshni - API Project","image_24":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_bot":true,"is_app_user":false,"updated":1602017279}],"cache_ts":1602126288,"response_metadata":{"next_cursor":""}}' + recorded_at: Thu, 08 Oct 2020 03:04:48 GMT +recorded_with: VCR 6.0.0 diff --git a/test/cassettes/send_message_to_recipient.yml b/test/cassettes/send_message_to_recipient.yml new file mode 100644 index 00000000..ffe0b3f9 --- /dev/null +++ b/test/cassettes/send_message_to_recipient.yml @@ -0,0 +1,257 @@ +--- +http_interactions: +- request: + method: post + uri: https://slack.com/api/chat.postMessage?channel=U01BKP7MGVD&icon_emoji=&text=maracuyA&token=&username= + body: + encoding: UTF-8 + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 09 Oct 2020 17:23:23 GMT + Server: + - Apache + X-Slack-Req-Id: + - fb46e3b1762506f3954db3d513135472 + X-Oauth-Scopes: + - users:read,channels:read,chat:write,incoming-webhook,groups:read,im:read,mpim:read,chat:write.customize + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Origin: + - "*" + X-Slack-Backend: + - r + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - chat:write + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Content-Length: + - '173' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-xsri,haproxy-edge-pdx-ed3w + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channel":"D01CD4P11J5","ts":"1602264203.000100","message":{"type":"message","subtype":"bot_message","text":"maracuyA","ts":"1602264203.000100","username":"Fire + - Pauline - Slack CLI","bot_id":"B01C94S0PMJ"}}' + recorded_at: Fri, 09 Oct 2020 17:23:23 GMT +- request: + method: post + uri: https://slack.com/api/chat.postMessage?channel=0000000000000000000000&icon_emoji=&text=testing&token=&username= + body: + encoding: UTF-8 + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 09 Oct 2020 17:27:35 GMT + Server: + - Apache + X-Slack-Req-Id: + - a41107ffb5a72935fa89d8df0de03a5f + X-Oauth-Scopes: + - users:read,channels:read,chat:write,incoming-webhook,groups:read,im:read,mpim:read,chat:write.customize + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Origin: + - "*" + X-Slack-Backend: + - r + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - chat:write + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Content-Length: + - '60' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-wsih,haproxy-edge-pdx-74gg + body: + encoding: ASCII-8BIT + string: '{"ok":false,"error":"channel_not_found"}' + recorded_at: Fri, 09 Oct 2020 17:27:35 GMT +- request: + method: post + uri: https://slack.com/api/chat.postMessage?channel=C01BKP7MWNB&icon_emoji=&text=maracuyA&token=&username= + body: + encoding: UTF-8 + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 09 Oct 2020 17:27:36 GMT + Server: + - Apache + X-Slack-Req-Id: + - 3cc81fd22d01bdb90af043c670c6b437 + X-Oauth-Scopes: + - users:read,channels:read,chat:write,incoming-webhook,groups:read,im:read,mpim:read,chat:write.customize + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Origin: + - "*" + X-Slack-Backend: + - r + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - chat:write + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Content-Length: + - '175' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-cv6x,haproxy-edge-pdx-333x + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channel":"C01BKP7MWNB","ts":"1602264456.000100","message":{"type":"message","subtype":"bot_message","text":"maracuyA","ts":"1602264456.000100","username":"Fire + - Pauline - Slack CLI","bot_id":"B01C94S0PMJ"}}' + recorded_at: Fri, 09 Oct 2020 17:27:36 GMT +- request: + method: post + uri: https://slack.com/api/chat.postMessage?channel=C01BKP7MWNB&icon_emoji=dog&text=hi&token=&username=woof + body: + encoding: UTF-8 + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 09 Oct 2020 17:27:38 GMT + Server: + - Apache + X-Slack-Req-Id: + - 13c10d8a03347cca39950b947bf92358 + X-Oauth-Scopes: + - users:read,channels:read,chat:write,incoming-webhook,groups:read,im:read,mpim:read,chat:write.customize + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Origin: + - "*" + X-Slack-Backend: + - r + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - chat:write + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Content-Length: + - '230' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-iyt0,haproxy-edge-pdx-iofq + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channel":"C01BKP7MWNB","ts":"1602264458.000200","message":{"type":"message","subtype":"bot_message","text":"hi","ts":"1602264458.000200","username":"woof","icons":{"emoji":"dog","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/2b55.png"},"bot_id":"B01C94S0PMJ"}}' + recorded_at: Fri, 09 Oct 2020 17:27:38 GMT +recorded_with: VCR 6.0.0 diff --git a/test/cassettes/send_message_to_recipient_from_bot.yml b/test/cassettes/send_message_to_recipient_from_bot.yml new file mode 100644 index 00000000..e8155fe9 --- /dev/null +++ b/test/cassettes/send_message_to_recipient_from_bot.yml @@ -0,0 +1,320 @@ +--- +http_interactions: +- request: + method: post + uri: https://slack.com/api/chat.postMessage?channel=USLACKBOT&text=maracuyA&token= + body: + encoding: UTF-8 + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 09 Oct 2020 03:19:05 GMT + Server: + - Apache + X-Slack-Req-Id: + - ef71909ca487c94a2a49fc5c69771488 + X-Oauth-Scopes: + - users:read,channels:read,chat:write,incoming-webhook,groups:read,im:read,mpim:read,chat:write.customize + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Origin: + - "*" + X-Slack-Backend: + - r + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - chat:write + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Content-Length: + - '337' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-em6d,haproxy-edge-pdx-rshi + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channel":"D01CSQTE4QG","ts":"1602213545.000100","message":{"bot_id":"B01C94S0PMJ","type":"message","text":"maracuyA","user":"U01BW7XP2KY","ts":"1602213545.000100","team":"T01C6M7N136","bot_profile":{"id":"B01C94S0PMJ","deleted":false,"name":"Fire + - Pauline - Slack CLI","updated":1602014193,"app_id":"A01BZS74GDB","icons":{"image_36":"https:\/\/a.slack-edge.com\/80588\/img\/plugins\/app\/bot_36.png","image_48":"https:\/\/a.slack-edge.com\/80588\/img\/plugins\/app\/bot_48.png","image_72":"https:\/\/a.slack-edge.com\/80588\/img\/plugins\/app\/service_72.png"},"team_id":"T01C6M7N136"}}}' + recorded_at: Fri, 09 Oct 2020 03:19:05 GMT +- request: + method: get + uri: https://slack.com/api/conversations.members?channel=D01CSQTE4QG&token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 09 Oct 2020 03:19:05 GMT + Server: + - Apache + X-Slack-Req-Id: + - 61f6f270cb8de1a0f31766868a8b4583 + X-Oauth-Scopes: + - users:read,channels:read,chat:write,incoming-webhook,groups:read,im:read,mpim:read,chat:write.customize + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Origin: + - "*" + X-Slack-Backend: + - r + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - channels:read,groups:read,mpim:read,im:read,read + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Content-Length: + - '106' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-jael,haproxy-edge-pdx-ggfr + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":["U01BW7XP2KY","USLACKBOT"],"response_metadata":{"next_cursor":""}}' + recorded_at: Fri, 09 Oct 2020 03:19:06 GMT +- request: + method: post + uri: https://slack.com/api/chat.postMessage?channel=C01BKP7MWNB&text=maracuyA&token= + body: + encoding: UTF-8 + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 09 Oct 2020 03:19:07 GMT + Server: + - Apache + X-Slack-Req-Id: + - 0cb2321962a68f8f721ca94ad476f729 + X-Oauth-Scopes: + - users:read,channels:read,chat:write,incoming-webhook,groups:read,im:read,mpim:read,chat:write.customize + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Origin: + - "*" + X-Slack-Backend: + - r + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - chat:write + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Content-Length: + - '338' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-3bes,haproxy-edge-pdx-rshi + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channel":"C01BKP7MWNB","ts":"1602213547.009300","message":{"bot_id":"B01C94S0PMJ","type":"message","text":"maracuyA","user":"U01BW7XP2KY","ts":"1602213547.009300","team":"T01C6M7N136","bot_profile":{"id":"B01C94S0PMJ","deleted":false,"name":"Fire + - Pauline - Slack CLI","updated":1602014193,"app_id":"A01BZS74GDB","icons":{"image_36":"https:\/\/a.slack-edge.com\/80588\/img\/plugins\/app\/bot_36.png","image_48":"https:\/\/a.slack-edge.com\/80588\/img\/plugins\/app\/bot_48.png","image_72":"https:\/\/a.slack-edge.com\/80588\/img\/plugins\/app\/service_72.png"},"team_id":"T01C6M7N136"}}}' + recorded_at: Fri, 09 Oct 2020 03:19:07 GMT +- request: + method: post + uri: https://slack.com/api/chat.postMessage?channel=USLACKBOT&icon_emoji=dog&text=maracuyA&token=&username=Bork + body: + encoding: UTF-8 + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 09 Oct 2020 03:20:17 GMT + Server: + - Apache + X-Slack-Req-Id: + - 13a283d57625a15bc35958bf530cdac2 + X-Oauth-Scopes: + - users:read,channels:read,chat:write,incoming-webhook,groups:read,im:read,mpim:read,chat:write.customize + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Origin: + - "*" + X-Slack-Backend: + - r + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - chat:write + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Content-Length: + - '234' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-x7jt,haproxy-edge-pdx-4ut7 + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channel":"D01BUMDABT9","ts":"1602213617.000100","message":{"type":"message","subtype":"bot_message","text":"maracuyA","ts":"1602213617.000100","username":"Bork","icons":{"emoji":"dog","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/2b55.png"},"bot_id":"B01C94S0PMJ"}}' + recorded_at: Fri, 09 Oct 2020 03:20:17 GMT +- request: + method: get + uri: https://slack.com/api/conversations.members?channel=D01BUMDABT9&token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 09 Oct 2020 03:20:17 GMT + Server: + - Apache + X-Slack-Req-Id: + - 8e0ae5a76922d8d8b5bc4dbcc1f927e0 + X-Oauth-Scopes: + - users:read,channels:read,chat:write,incoming-webhook,groups:read,im:read,mpim:read,chat:write.customize + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Origin: + - "*" + X-Slack-Backend: + - r + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - channels:read,groups:read,mpim:read,im:read,read + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Content-Length: + - '60' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-uju0,haproxy-edge-pdx-4yzm + body: + encoding: ASCII-8BIT + string: '{"ok":false,"error":"channel_not_found"}' + recorded_at: Fri, 09 Oct 2020 03:20:17 GMT +recorded_with: VCR 6.0.0 diff --git a/test/cassettes/workspace.yml b/test/cassettes/workspace.yml new file mode 100644 index 00000000..6be2c429 --- /dev/null +++ b/test/cassettes/workspace.yml @@ -0,0 +1,284 @@ +--- +http_interactions: +- request: + method: get + uri: https://slack.com/api/users.list?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 08 Oct 2020 03:04:41 GMT + Server: + - Apache + X-Slack-Req-Id: + - ef6d4bbf6ad04d27c41d0defc6353ea1 + X-Oauth-Scopes: + - users:read,channels:read,chat:write,incoming-webhook + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Origin: + - "*" + X-Slack-Backend: + - r + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - users:read + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Content-Length: + - '1448' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-x7jt,haproxy-edge-pdx-5vxz + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"T01C6M7N136","name":"slackbot","deleted":false,"color":"757575","real_name":"Slackbot","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Slackbot","real_name_normalized":"Slackbot","display_name":"Slackbot","display_name_normalized":"Slackbot","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"sv41d8cd98f0","always_active":true,"first_name":"slackbot","last_name":"","image_24":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_24.png","image_32":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_32.png","image_48":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_48.png","image_72":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_72.png","image_192":"https:\/\/a.slack-edge.com\/80588\/marketing\/img\/avatars\/slackbot\/avatar-slackbot.png","image_512":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":0},{"id":"U01BKP7MGVD","team_id":"T01C6M7N136","name":"pauline.chane","deleted":false,"color":"9f69e7","real_name":"pauline.chane","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"pauline.chane","real_name_normalized":"pauline.chane","display_name":"","display_name_normalized":"","fields":null,"status_text":"HI + ROSHNI","status_emoji":":heart:","status_expiration":1602140399,"avatar_hash":"gac6154e1c22","image_24":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":true,"is_owner":true,"is_primary_owner":true,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1602119098},{"id":"U01BW7XP2KY","team_id":"T01C6M7N136","name":"fire_pauline_slack_cl","deleted":false,"color":"e7392d","real_name":"Fire + - Pauline - Slack CLI","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight + Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Fire + - Pauline - Slack CLI","real_name_normalized":"Fire - Pauline - Slack CLI","display_name":"","display_name_normalized":"","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gd69838ab849","api_app_id":"A01BZS74GDB","always_active":false,"bot_id":"B01C94S0PMJ","image_24":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":true,"is_app_user":false,"updated":1602014193},{"id":"U01BXCZPJBF","team_id":"T01C6M7N136","name":"rpatel01","deleted":false,"color":"4bbe2e","real_name":"Roshni + Patel","tz":"America\/Chicago","tz_label":"Central Daylight Time","tz_offset":-18000,"profile":{"title":"","phone":"","skype":"","real_name":"Roshni + Patel","real_name_normalized":"Roshni Patel","display_name":"roshni.patel","display_name_normalized":"roshni.patel","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g06d8eb9fe76","first_name":"Roshni","last_name":"Patel","image_24":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":true,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1602115573},{"id":"U01C33TL48J","team_id":"T01C6M7N136","name":"fire_roshni_api_pro2","deleted":false,"color":"674b1b","real_name":"Fire + - Roshni - API Project","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight + Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Fire + - Roshni - API Project","real_name_normalized":"Fire - Roshni - API Project","display_name":"","display_name_normalized":"","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g4bff6015394","api_app_id":"A01C98GFT5J","always_active":false,"bot_id":"B01BWBQTUEA","image_24":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":true,"is_app_user":false,"updated":1602017351},{"id":"U01CFJST9SM","team_id":"T01C6M7N136","name":"fire_roshni_api_proje","deleted":true,"profile":{"title":"","phone":"","skype":"","real_name":"Fire + - Roshni - API Project","real_name_normalized":"Fire - Roshni - API Project","display_name":"","display_name_normalized":"","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g0a5c0c0a39c","api_app_id":"A01CSQSKQE4","always_active":false,"bot_id":"B01CSR2C56U","first_name":"Fire","last_name":"- + Roshni - API Project","image_24":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_bot":true,"is_app_user":false,"updated":1602017279}],"cache_ts":1602126281,"response_metadata":{"next_cursor":""}}' + recorded_at: Thu, 08 Oct 2020 03:04:41 GMT +- request: + method: get + uri: https://slack.com/api/conversations.list?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 08 Oct 2020 03:04:41 GMT + Server: + - Apache + X-Slack-Req-Id: + - 6160e2f9b27de60f215a45ff91e65b48 + X-Oauth-Scopes: + - users:read,channels:read,chat:write,incoming-webhook + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Origin: + - "*" + X-Slack-Backend: + - r + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - channels:read,groups:read,mpim:read,im:read,read + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Content-Length: + - '719' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-tazm,haproxy-edge-pdx-rj19 + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channels":[{"id":"C01BKP7MWNB","name":"random","is_channel":true,"is_group":false,"is_im":false,"created":1601939539,"is_archived":false,"is_general":false,"unlinked":0,"name_normalized":"random","is_shared":false,"parent_conversation":null,"creator":"U01BKP7MGVD","is_ext_shared":false,"is_org_shared":false,"shared_team_ids":["T01C6M7N136"],"pending_shared":[],"pending_connected_team_ids":[],"is_pending_ext_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"This + channel is for... well, everything else. It\u2019s a place for team jokes, + spur-of-the-moment ideas, and funny GIFs. Go wild!","creator":"U01BKP7MGVD","last_set":1601939539},"previous_names":[],"num_members":4},{"id":"C01BKP8MF2T","name":"ada-c14-slack-cli-project","is_channel":true,"is_group":false,"is_im":false,"created":1601939581,"is_archived":false,"is_general":false,"unlinked":0,"name_normalized":"ada-c14-slack-cli-project","is_shared":false,"parent_conversation":null,"creator":"U01BKP7MGVD","is_ext_shared":false,"is_org_shared":false,"shared_team_ids":["T01C6M7N136"],"pending_shared":[],"pending_connected_team_ids":[],"is_pending_ext_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"This + *channel* is for working on a project. Hold meetings, share docs, and make + decisions together with your team.","creator":"U01BKP7MGVD","last_set":1601939581},"previous_names":[],"num_members":3},{"id":"C01C0MP03K5","name":"general","is_channel":true,"is_group":false,"is_im":false,"created":1601939538,"is_archived":false,"is_general":true,"unlinked":0,"name_normalized":"general","is_shared":false,"parent_conversation":null,"creator":"U01BKP7MGVD","is_ext_shared":false,"is_org_shared":false,"shared_team_ids":["T01C6M7N136"],"pending_shared":[],"pending_connected_team_ids":[],"is_pending_ext_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"This + is the one channel that will always include everyone. It\u2019s a great spot + for announcements and team-wide conversations.","creator":"U01BKP7MGVD","last_set":1601939538},"previous_names":[],"num_members":4},{"id":"C01C6J4TD7D","name":"do-not-add-bots","is_channel":true,"is_group":false,"is_im":false,"created":1602117099,"is_archived":false,"is_general":false,"unlinked":0,"name_normalized":"do-not-add-bots","is_shared":false,"parent_conversation":null,"creator":"U01BKP7MGVD","is_ext_shared":false,"is_org_shared":false,"shared_team_ids":["T01C6M7N136"],"pending_shared":[],"pending_connected_team_ids":[],"is_pending_ext_shared":false,"is_member":false,"is_private":false,"is_mpim":false,"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"debugging","creator":"U01BKP7MGVD","last_set":1602117099},"previous_names":[],"num_members":2}],"response_metadata":{"next_cursor":""}}' + recorded_at: Thu, 08 Oct 2020 03:04:41 GMT +- request: + method: get + uri: https://slack.com/api/auth.test?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 08 Oct 2020 22:26:00 GMT + Server: + - Apache + X-Slack-Req-Id: + - b405f79228d2d5315b96906e64ff1cc8 + X-Oauth-Scopes: + - users:read,channels:read,chat:write,incoming-webhook,groups:read,im:read,mpim:read,chat:write.customize + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Origin: + - "*" + X-Slack-Backend: + - r + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + Pragma: + - no-cache + Content-Length: + - '160' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-p65w,haproxy-edge-pdx-locq + body: + encoding: ASCII-8BIT + string: '{"ok":true,"url":"https:\/\/slackclitest.slack.com\/","team":"SlackCLITest","user":"fire_pauline_slack_cl","team_id":"T01C6M7N136","user_id":"U01BW7XP2KY","bot_id":"B01C94S0PMJ"}' + recorded_at: Thu, 08 Oct 2020 22:26:00 GMT +- request: + method: get + uri: https://slack.com/api/users.list?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 08 Oct 2020 22:38:49 GMT + Server: + - Apache + X-Slack-Req-Id: + - b8b2d59f162f99abb1d7f965c9b9fd22 + X-Oauth-Scopes: + - users:read,channels:read,chat:write,incoming-webhook,groups:read,im:read,mpim:read,chat:write.customize + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Origin: + - "*" + X-Slack-Backend: + - r + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - users:read + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Vary: + - Accept-Encoding + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Content-Length: + - '1416' + Content-Type: + - application/json; charset=utf-8 + X-Via: + - haproxy-www-49bf,haproxy-edge-pdx-bm9l + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"T01C6M7N136","name":"slackbot","deleted":false,"color":"757575","real_name":"Slackbot","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Slackbot","real_name_normalized":"Slackbot","display_name":"Slackbot","display_name_normalized":"Slackbot","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"sv41d8cd98f0","always_active":true,"first_name":"slackbot","last_name":"","image_24":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_24.png","image_32":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_32.png","image_48":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_48.png","image_72":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_72.png","image_192":"https:\/\/a.slack-edge.com\/80588\/marketing\/img\/avatars\/slackbot\/avatar-slackbot.png","image_512":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":0},{"id":"U01BKP7MGVD","team_id":"T01C6M7N136","name":"pauline.chane","deleted":false,"color":"9f69e7","real_name":"pauline.chane","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"pauline.chane","real_name_normalized":"pauline.chane","display_name":"","display_name_normalized":"","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gac6154e1c22","image_24":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/ac6154e1c224ad644230148686eca456.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":true,"is_owner":true,"is_primary_owner":true,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1602140346},{"id":"U01BW7XP2KY","team_id":"T01C6M7N136","name":"fire_pauline_slack_cl","deleted":false,"color":"e7392d","real_name":"Fire + - Pauline - Slack CLI","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight + Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Fire + - Pauline - Slack CLI","real_name_normalized":"Fire - Pauline - Slack CLI","display_name":"","display_name_normalized":"","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gd69838ab849","api_app_id":"A01BZS74GDB","always_active":false,"bot_id":"B01C94S0PMJ","image_24":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/d69838ab849b8f71f498ba5e91db6ffc.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0004-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":true,"is_app_user":false,"updated":1602014193},{"id":"U01BXCZPJBF","team_id":"T01C6M7N136","name":"rpatel01","deleted":false,"color":"4bbe2e","real_name":"Roshni + Patel","tz":"America\/Chicago","tz_label":"Central Daylight Time","tz_offset":-18000,"profile":{"title":"","phone":"","skype":"","real_name":"Roshni + Patel","real_name_normalized":"Roshni Patel","display_name":"roshni.patel","display_name_normalized":"roshni.patel","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g06d8eb9fe76","first_name":"Roshni","last_name":"Patel","image_24":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/06d8eb9fe76adc7430610fc5619b7dae.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0001-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":true,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1602115573},{"id":"U01C33TL48J","team_id":"T01C6M7N136","name":"fire_roshni_api_pro2","deleted":false,"color":"674b1b","real_name":"Fire + - Roshni - API Project","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight + Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Fire + - Roshni - API Project","real_name_normalized":"Fire - Roshni - API Project","display_name":"","display_name_normalized":"","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g4bff6015394","api_app_id":"A01C98GFT5J","always_active":false,"bot_id":"B01BWBQTUEA","image_24":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/4bff60153947fde20f503d4cf95c2095.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0002-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":true,"is_app_user":false,"updated":1602017351},{"id":"U01CFJST9SM","team_id":"T01C6M7N136","name":"fire_roshni_api_proje","deleted":true,"profile":{"title":"","phone":"","skype":"","real_name":"Fire + - Roshni - API Project","real_name_normalized":"Fire - Roshni - API Project","display_name":"","display_name_normalized":"","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g0a5c0c0a39c","api_app_id":"A01CSQSKQE4","always_active":false,"bot_id":"B01CSR2C56U","first_name":"Fire","last_name":"- + Roshni - API Project","image_24":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/0a5c0c0a39ccd085e6f8b6f864f95dce.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-512.png","status_text_canonical":"","team":"T01C6M7N136"},"is_bot":true,"is_app_user":false,"updated":1602017279}],"cache_ts":1602196729,"response_metadata":{"next_cursor":""}}' + recorded_at: Thu, 08 Oct 2020 22:38:49 GMT +recorded_with: VCR 6.0.0 diff --git a/test/channel_test.rb b/test/channel_test.rb new file mode 100644 index 00000000..61af5311 --- /dev/null +++ b/test/channel_test.rb @@ -0,0 +1,57 @@ +require_relative 'test_helper' + +describe "Channel" do + before do + @channel = Channel.new(slack_id: "C01BKP7MWNB", name: "random", topic: "", member_count: 2) + end + + describe "Initialize method" do + it "it creates an instance of channel" do + expect(@channel).must_be_kind_of Recipient + expect(@channel).must_be_instance_of Channel + expect(@channel.slack_id).must_equal "C01BKP7MWNB" + expect(@channel.name).must_equal "random" + expect(@channel.topic).must_equal "" + expect(@channel.member_count).must_equal 2 + end + end + + describe "Details method" do + it "lists the details for a channel" do + # Arrange and Act + channel_details = @channel.details + + # Assert + expect(@channel.details).must_be_kind_of Hash + expect(channel_details[:SLACK_ID]).must_equal @channel.slack_id + expect(channel_details[:NAME]).must_equal @channel.name + expect(channel_details[:TOPIC]).must_equal @channel.topic + expect(channel_details[:MEMBER_COUNT]).must_equal @channel.member_count + end + end + + describe "List all method" do + it "returns all channels in the workspace" do + VCR.use_cassette("list_all") do + # Arrange + CHANNELS_URL = "https://slack.com/api/conversations.list" + response = HTTParty.get(CHANNELS_URL, query: {token: Channel.token})["channels"] + + # Act + channels = Channel.list_all + + # Assert + expect(Channel.list_all.length).must_equal response.length + response.length.times do |i| + expect(response[i]["id"]).must_equal channels[i].slack_id + expect(response[i]["name"]).must_equal channels[i].name + expect(response[i]["topic"]["value"]).must_equal channels[i].topic + expect(response[i]["num_members"]).must_equal channels[i].member_count + end + + # NOTE: We didn't write a test to check whether the token is valid because that has already been tested in the + # .get method in Recipient.rb from which it inherits, meaning it should work here too for channel.rb + end + end + end +end diff --git a/test/recipient_test.rb b/test/recipient_test.rb new file mode 100644 index 00000000..4ac3a1f1 --- /dev/null +++ b/test/recipient_test.rb @@ -0,0 +1,105 @@ +require_relative 'test_helper' + +describe "Recipient" do + describe 'constructor' do + it "creates a Recipient object" do + test = Recipient.new(slack_id: "C01BKP7MWNB",name: "random") + expect(test).must_be_kind_of Recipient + expect(test.slack_id).must_equal "C01BKP7MWNB" + expect(test.name).must_equal "random" + end + end + + describe 'send_message' do + before do + # slackbot will be in every slack workspace + @test = Recipient.new(slack_id: "U01BKP7MGVD",name: "pauline.chane") + end + it 'returns message hash for successful messages for users' do + VCR.use_cassette("send message to recipient") do + message = "maracuyA" + response = @test.send_message(message) + expect(response).must_be_instance_of Hash + expect(response['message']['text']).must_equal message + expect(response['channel']).must_equal "D01CD4P11J5" + end + end + it 'returns message hash for successful messages for channels' do + VCR.use_cassette("send message to recipient") do + channel = Recipient.new(slack_id: "C01BKP7MWNB",name: "random") + message = "maracuyA" + response = channel.send_message(message) + expect(response).must_be_instance_of Hash + # for messages to channels + expect(response['channel']).must_include channel.slack_id + end + end + it "rejects messages longer than 4000 characters" do + VCR.use_cassette("send message to recipient") do + message = "" + 4005.times do + message += "A" + end + expect do + @test.send_message(message) + end.must_raise SlackApiError + end + end + it "rejects attempts to send messages to invalid users/channels" do + VCR.use_cassette("send message to recipient") do + false_recipient = Recipient.new(slack_id: "0000000000000000000000", name: "false_user") + message = "testing" + expect do + false_recipient.send_message(message) + end.must_raise SlackApiError + end + end + it "correctly sends message for customized bot" do + VCR.use_cassette("send_message_to_recipient") do + channel = Recipient.new(slack_id: "C01BKP7MWNB",name: "random") + response = channel.send_message("hi", emoji: "dog", send_as: "woof") + expect(response["message"]["username"]).must_equal "woof" + expect(response["message"]["icons"]["emoji"]).must_equal "dog" + end + end + end + describe 'self.get' do + it 'raises a SlackApiError if parameter input is invalid' do + VCR.use_cassette("Recipient.get") do + url = "https://slack.com/api/conversations.list" + param = {token: 'blah'} + expect do + Recipient.get(url, param) + end.must_raise SlackApiError + expect do + Recipient.get("https://slack.com/api/monkeys", {token: Recipient.token}) + end.must_raise SlackApiError + end + end + + it 'returns a response for url and legal params' do + VCR.use_cassette("Recipient.get") do + url = "https://slack.com/api/conversations.list" + param = {token: Recipient.token} + response = Recipient.get(url, param) + expect(response["ok"]).must_equal true + end + end + end + describe 'details' do + it "raises NotImplementedError if called from Recipient" do + test = Recipient.new(slack_id: "C01BKP7MWNB", name: "random") + expect do + test.details + end.must_raise NotImplementedError + end + end + + describe 'self.list_all' do + it "raises NotImplementedError if called from Recipient" do + expect do + Recipient.list_all + end.must_raise NotImplementedError + end + end +end \ No newline at end of file diff --git a/test/slack_api_error_test.rb b/test/slack_api_error_test.rb new file mode 100644 index 00000000..dcc23439 --- /dev/null +++ b/test/slack_api_error_test.rb @@ -0,0 +1,9 @@ +require_relative 'test_helper' + +describe SlackApiError do + it 'creates a custom SlackApiError that inherits from StandardError' do + error = SlackApiError.new + expect(error).must_be_instance_of SlackApiError + expect(error).must_be_kind_of StandardError + end +end \ No newline at end of file diff --git a/test/test_helper.rb b/test/test_helper.rb index 1fcf2bab..6d276751 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -3,11 +3,23 @@ add_filter 'test/' end +require 'dotenv' +Dotenv.load + require 'minitest' require 'minitest/autorun' require 'minitest/reporters' require 'minitest/skip_dsl' require 'vcr' +require 'webmock/minitest' +require_relative '../lib/recipient' +require_relative '../lib/slack' +require_relative '../lib/channel' +require_relative '../lib/user' +require_relative '../lib/workspace' +require_relative '../lib/bot' +require_relative '../lib/slack_api_error' + Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new @@ -25,5 +37,7 @@ } # Don't leave our token lying around in a cassette file. - + config.filter_sensitive_data("") do + ENV["SLACK_TOKEN"] + end end diff --git a/test/user_test.rb b/test/user_test.rb new file mode 100644 index 00000000..7289d4c3 --- /dev/null +++ b/test/user_test.rb @@ -0,0 +1,59 @@ +require_relative 'test_helper' + +describe User do + before do + @user = User.new(slack_id: "USLACKBOT", name: "slackbot", real_name: "Slackbot") + end + describe 'constructor' do + it "creates an instance of user with appropriate fields" do + # Assert + expect(@user).must_be_instance_of User + expect(@user).must_be_kind_of Recipient + expect(@user.slack_id).must_equal "USLACKBOT" + expect(@user.name).must_equal "slackbot" + expect(@user.real_name).must_equal "Slackbot" + expect(@user.time_zone).must_equal "Pacific Daylight Time" + expect(@user.is_bot).must_equal false + end + end + describe 'details' do + it "lists the details for a user" do + # Arrange and Act + user_details = @user.details + + # Assert + expect(user_details).must_be_kind_of Hash + expect(user_details[:SLACK_ID]).must_equal @user.slack_id + expect(user_details[:NAME]).must_equal @user.name + expect(user_details[:REAL_NAME]).must_equal @user.real_name + expect(user_details[:TIME_ZONE]).must_equal @user.time_zone + expect(user_details[:IS_BOT]).must_equal @user.is_bot + end + end + describe 'self.list_all' do + it "returns all users in the workspace" do + VCR.use_cassette("list_all") do + # Arrange + USERS_URL = "https://slack.com/api/users.list" + # SLACK_TOKEN = ENV["SLACK_TOKEN"] + response = HTTParty.get(USERS_URL, query: {token: User.token})["members"] + response = response.filter{ |member| !member["deleted"]} # remove deleted members + # Act + users = User.list_all + + # Assert + expect(User.list_all.length).must_equal response.length + response.length.times do |i| + expect(response[i]["id"]).must_equal users[i].slack_id + expect(response[i]["name"]).must_equal users[i].name + expect(response[i]["real_name"]).must_equal users[i].real_name + expect(response[i]["tz_label"]).must_equal users[i].time_zone + expect(response[i]["is_bot"]).must_equal users[i].is_bot + end + + # NOTE: We didn't write a test to check whether the token is valid because that has already been tested in the + # .get method in Recipient.rb from which it inherits, meaning it should work here too for user.rb + end + end + end +end diff --git a/test/workspace_test.rb b/test/workspace_test.rb new file mode 100644 index 00000000..a018d215 --- /dev/null +++ b/test/workspace_test.rb @@ -0,0 +1,141 @@ +require_relative 'test_helper' + +describe Workspace do + before do + VCR.use_cassette("workspace") do + @ws = Workspace.new + end + end + describe "constructor" do + it "correctly initializes workspace with a list of channels and users from Slack workspace" do + # Arrange and Act + VCR.use_cassette("workspace") do + user_list = User.list_all + channel_list = Channel.list_all + current_bot = Bot.current_bot + # Assert + expect(@ws).must_be_instance_of Workspace + expect(@ws.users).must_be_instance_of Array + expect(@ws.channels).must_be_instance_of Array + user_list.length.times do |i| + expect(@ws.users[i]).must_be_kind_of User + expect(@ws.users[i].slack_id).must_equal user_list[i].slack_id + expect(@ws.users[i].name).must_equal user_list[i].name + expect(@ws.users[i].real_name).must_equal user_list[i].real_name + expect(@ws.users[i].time_zone).must_equal user_list[i].time_zone + # NOTE: in the data from Slack API, Slackbot is not considered a bot! + expect(@ws.users[i].is_bot).must_equal user_list[i].is_bot + end + channel_list.length.times do |i| + expect(@ws.channels[i]).must_be_kind_of Channel + expect(@ws.channels[i].slack_id).must_equal channel_list[i].slack_id + expect(@ws.channels[i].name).must_equal channel_list[i].name + expect(@ws.channels[i].topic).must_equal channel_list[i].topic + expect(@ws.channels[i].member_count).must_equal channel_list[i].member_count + end + + expect(@ws.current_bot).must_be_kind_of Bot + expect(@ws.current_bot.slack_id).must_equal current_bot.slack_id + expect(@ws.current_bot.name).must_equal current_bot.name + expect(@ws.current_bot.real_name).must_equal current_bot.real_name + expect(@ws.current_bot.time_zone).must_equal current_bot.time_zone + expect(@ws.current_bot.is_bot).must_equal current_bot.is_bot + expect(@ws.current_bot.send_as).must_equal current_bot.send_as + expect(@ws.current_bot.emoji).must_equal current_bot.emoji + end + end + end + + describe "select_user" do + it "returns user input for successful match" do + slackbot = @ws.users.find{|user| user.slack_id == "USLACKBOT"} + + @ws.select_user("slackbot") # by name + expect(@ws.selected).must_equal slackbot + + @ws.select_user(nil) # to reset + + @ws.select_user("USLACKBOT") # by ID + expect(@ws.selected).must_equal slackbot + end + it "returns nil for cases when user name/slack id are not matched" do + expect(@ws.select_user(nil)).must_be_nil + # slack usernames have a 21 character limit + expect(@ws.select_user("SlackSlackSlackSlackSlack")).must_be_nil + end + + it "selects current_bot as Bot object if current bot is selected" do + @ws.select_user(@ws.current_bot.name) + expect(@ws.selected).must_be_instance_of Bot + expect(@ws.selected).must_equal @ws.current_bot + end + end + + describe "select_channel" do + it "returns channel input for successful match" do + random = @ws.channels.find{|channel| channel.name == "random"} + + + @ws.select_channel("random") # by name + expect(@ws.selected).must_equal random + + @ws.clear_selection # to reset + + @ws.select_channel(random.slack_id) # by ID + expect(@ws.selected).must_equal random + end + it "returns nil for cases when channel name/slack id are not matched" do + expect(@ws.select_channel(nil)).must_be_nil + # slack usernames have a 21 character limit + expect(@ws.select_channel("SlackSlackSlackSlackSlack")).must_be_nil + end + end + + describe "clear_selection" do + it "clears @selected field in workspace" do + @ws.select_user("slackbot") + @ws.clear_selection + expect(@ws.selected).must_be_nil + end + end + + describe "show_details" do + it "returns return of .details of recipient selected" do + @ws.select_user("slackbot") + temp_store = @ws.selected.details # since show_details resets selected, save this + user_detail = @ws.show_details + + # compare temp_store details with show_details results + expect(user_detail).must_be_instance_of Hash + expect(user_detail[:SLACK_ID]).must_equal temp_store[:SLACK_ID] + expect(user_detail[:NAME]).must_equal temp_store[:NAME] + expect(user_detail[:REAL_NAME]).must_equal temp_store[:REAL_NAME] + expect(user_detail[:TIME_ZONE]).must_equal temp_store[:TIME_ZONE] + # NOTE: in the data from Slack API, Slackbot is not considered a bot! + expect(user_detail[:IS_BOT]).must_equal temp_store[:IS_BOT] + end + it "returns nil if no recipient selected" do + expect(@ws.show_details).must_be_nil + end + end + + describe "send_message" do + it "returns nil if no recipient is selected " do + VCR.use_cassette("Workspace send_message") do + expect(@ws.send_message("hi")).must_be_nil + end + end + it "sends a message when a recipient is selected" do + VCR.use_cassette("Workspace send_message") do + user = @ws.users.find{ |user| user.name == "slackbot" } + # select user to send message to + @ws.select_user("slackbot") + response = @ws.send_message("HEY LISTEN") + expect(response).must_be_instance_of Hash + expect(response['message']['text']).must_equal "HEY LISTEN" + # for DMs since this is to a DM with Slackbot + expect(response['channel']).must_equal "D01BUMDABT9" + end + end + end +end