Skip to content

Instantly share code, notes, and snippets.

@looneym
Created July 27, 2017 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save looneym/f1d0af54a57035b93f10e8c74d2f4dfb to your computer and use it in GitHub Desktop.
Save looneym/f1d0af54a57035b93f10e8c74d2f4dfb to your computer and use it in GitHub Desktop.
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