Created
July 27, 2017 13:22
-
-
Save looneym/f1d0af54a57035b93f10e8c74d2f4dfb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module IntercomUtil | |
require 'intercom' | |
TOKEN = ENV["INTERCOM_PAT"] | |
@intercom = Intercom::Client.new(token: TOKEN) | |
def self.get_all_conversations | |
open_convos = @intercom.conversations.find_all(open: true) | |
closed_convos = @intercom.conversations.find_all(open: false) | |
all_convos_short = [] | |
all_convos_full = [] | |
open_convos.each do |i| | |
all_convos_short << i | |
end | |
closed_convos.each do |i| | |
all_convos_short << i | |
end | |
all_convos_short.each do |i| | |
all_convos_full << @intercom.conversations.find(id: i.id) | |
end | |
return all_convos_full | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment