@@ -149,7 +149,7 @@ intercom.tags.untag(name: 'blue', users: [{user_id: "42ea2f1b93891f6a99000427"}
149149intercom.tags.all.each {|tag | " #{ tag.id } - #{ tag.name } " }
150150intercom.tags.all.map {|tag | tag.name }
151151# Tag companies
152- tag = intercom.tags.tag(name: ' blue' , companies: [{id : " 42ea2f1b93891f6a99000427" }])
152+ tag = intercom.tags.tag(name: ' blue' , companies: [{company_id : " 42ea2f1b93891f6a99000427" }])
153153```
154154
155155#### Segments
@@ -191,6 +191,11 @@ intercom.conversations.find_all(email: '
[email protected] ', type: 'user').each {|c
191191intercom.conversations.find_all(
email: ' [email protected] ' ,
type: ' user' ,
unread: false ).each {|
convo | ... }
192192# Iterate over all unread conversations with a user based on the users email
193193intercom.conversations.find_all(
email: ' [email protected] ' ,
type: ' user' ,
unread: true ).each {|
convo | ... }
194+ # Iterate over all conversations for a user with their Intercom user ID
195+ intercom.conversations.find_all(intercom_user_id: ' 536e564f316c83104c000020' , type: ' user' ).each {|convo | ... }
196+ # Iterate over all conversations for a lead
197+ # NOTE: to iterate over a lead's conversations you MUST use their Intercom User ID and type User
198+ intercom.conversations.find_all(intercom_user_id: lead.id, type: ' user' ).each {|convo | ... }
194199
195200# FINDING A SINGLE CONVERSATION
196201conversation = intercom.conversations.find(id: ' 1' )
@@ -369,8 +374,31 @@ intercom.contacts.save(contact)
369374# Find contacts by email
370375contacts
= intercom.contacts.find_all(
email: " [email protected] " )
371376
377+ # Using find to search for contacts by email
378+ contact_list
= intercom.contacts.find(
email: " [email protected] " )
379+ # This returns a Contact object with type contact.list
380+ # Note: Multiple contacts can be returned in this list if there are multiple matching contacts found
381+ # #<Intercom::Contact:0x00007ff3a80789f8
382+ # @changed_fields=#<Set: {}>,
383+ # @contacts=
384+ # [{"type"=>"contact",
385+ # "id"=>"5b7fd9b683681ac52274b9c7",
386+ # "user_id"=>"05bc4d17-72cc-433e-88ae-0bf88db5d0e6",
387+ # "anonymous"=>true,
388+ 389+ # ...}],
390+ # @custom_attributes={},
391+ # @limited=false,
392+ # @pages=#<Intercom::Pages:0x00007ff3a7413c58 @changed_fields=#<Set: {}>, @next=nil, @page=1, @per_page=50, @total_pages=1, @type="pages">,
393+ # @total_count=1,
394+ # @type="contact.list">
395+ # Access the contact's data
396+ contact_list.contacts.first
397+
372398# Convert a contact into a user
373- intercom.contacts.convert(contact, user)
399+ contact = intercom.contacts.find(id: " 536e564f316c83104c000020" )
400+ intercom.contacts.convert(contact, Intercom ::User .new (email: email))
401+ # Using find with email will not work here. See https://github.com/intercom/intercom-ruby/issues/419 for more information
374402
375403# Delete a contact
376404intercom.contacts.delete(contact)
0 commit comments