Skip to content

Commit 67c4fdd

Browse files
authored
Updating readme to make it clearer how to convert a lead into a user (#421)
1 parent 976748e commit 67c4fdd

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,31 @@ intercom.contacts.save(contact)
369369
# Find contacts by email
370370
contacts = intercom.contacts.find_all(email: "[email protected]")
371371

372+
# Using find to search for contacts by email
373+
contact_list = intercom.contacts.find(email: "[email protected]")
374+
# This returns a Contact object with type contact.list
375+
# Note: Multiple contacts can be returned in this list if there are multiple matching contacts found
376+
# #<Intercom::Contact:0x00007ff3a80789f8
377+
# @changed_fields=#<Set: {}>,
378+
# @contacts=
379+
# [{"type"=>"contact",
380+
# "id"=>"5b7fd9b683681ac52274b9c7",
381+
# "user_id"=>"05bc4d17-72cc-433e-88ae-0bf88db5d0e6",
382+
# "anonymous"=>true,
383+
# "email"=>"[email protected]",
384+
# ...}],
385+
# @custom_attributes={},
386+
# @limited=false,
387+
# @pages=#<Intercom::Pages:0x00007ff3a7413c58 @changed_fields=#<Set: {}>, @next=nil, @page=1, @per_page=50, @total_pages=1, @type="pages">,
388+
# @total_count=1,
389+
# @type="contact.list">
390+
# Access the contact's data
391+
contact_list.contacts.first
392+
372393
# Convert a contact into a user
394+
contact = intercom.contacts.find(id: "536e564f316c83104c000020")
373395
intercom.contacts.convert(contact, Intercom::User.new(email: email))
396+
# Using find with email will not work here. See https://github.com/intercom/intercom-ruby/issues/419 for more information
374397

375398
# Delete a contact
376399
intercom.contacts.delete(contact)

0 commit comments

Comments
 (0)