README.md in intercom-3.6.2 vs README.md in intercom-3.7.0

- old
+ new

@@ -20,11 +20,11 @@ gem install intercom Using bundler: - gem 'intercom', '~> 3.6.1' + gem 'intercom', '~> 3.7.0' ## Basic Usage ### Configure your client @@ -66,13 +66,17 @@ user = intercom.users.find(user_id: "1") # Find user by id user = intercom.users.find(id: "1") # Create a user user = intercom.users.create(email: "bob@example.com", name: "Bob Smith", signed_up_at: Time.now.to_i) -# Delete a user +# archive a user user = intercom.users.find(id: "1") -deleted_user = intercom.users.delete(user) +archived_user = intercom.users.archive(user) +# request a hard delete for a user +(https://developers.intercom.com/intercom-api-reference/reference#delete-users) +user = intercom.users.find(id: "1") +deleted_user = intercom.users.request_hard_delete(user) # Update custom_attributes for a user user.custom_attributes["average_monthly_spend"] = 1234.56 intercom.users.save(user) # Perform incrementing user.increment('karma') @@ -133,11 +137,11 @@ intercom.companies.all.each {|company| puts %Q(#{company.name} - #{company.custom_attributes["referral_source"]}) } intercom.companies.all.map {|company| company.name } # Get a list of users in a company by Intercom Company ID intercom.companies.users_by_intercom_company_id(company.id) # Get a list of users in a company by external company_id -intercom.companies.users_by_company_id(company.company_id) +intercom.companies.users_by_company_id(company.company_id) # Get a large list of companies using scroll intercom.companies.scroll.each { |comp| puts comp.name} # Please see users scroll for more details of how to use scroll ``` @@ -196,11 +200,11 @@ intercom.conversations.find_all(email: 'joe@example.com', type: 'user', unread: false).each {|convo| ... } # Iterate over all unread conversations with a user based on the users email intercom.conversations.find_all(email: 'joe@example.com', type: 'user', unread: true).each {|convo| ... } # Iterate over all conversations for a user with their Intercom user ID intercom.conversations.find_all(intercom_user_id: '536e564f316c83104c000020', type: 'user').each {|convo| ... } -# Iterate over all conversations for a lead +# Iterate over all conversations for a lead # NOTE: to iterate over a lead's conversations you MUST use their Intercom User ID and type User intercom.conversations.find_all(intercom_user_id: lead.id, type: 'user').each {|convo| ... } # FINDING A SINGLE CONVERSATION conversation = intercom.conversations.find(id: '1') @@ -226,11 +230,11 @@ # Close intercom.conversations.close(id: conversation.id, admin_id: '123') # Assign -# Note: Conversations can be assigned to teams. However, the entity that performs the operation of assigning the conversation has to be an existing teammate. +# Note: Conversations can be assigned to teams. However, the entity that performs the operation of assigning the conversation has to be an existing teammate. # You can use `intercom.admins.all.each {|a| puts a.inspect if a.type == 'admin' }` to list all of your teammates. intercom.conversations.assign(id: conversation.id, admin_id: '123', assignee_id: '124') # Snooze intercom.conversations.snooze(id: conversation.id, admin_id: '123', snoozed_until: 9999999999) @@ -370,16 +374,23 @@ *NB:* This version of the gem reserves the field name `type` in Event data. ### Contacts `Contacts` represent logged out users of your application. +Note that `contacts` are referred to as `leads` in the [Intercom](https://developers.intercom.com/intercom-api-reference/reference#leads) ```ruby # Create a contact contact = intercom.contacts.create(email: "some_contact@example.com") -# Update a contact +# Update a contact (via create method) +# You can update a contact by calling the create method but you MUST provide an id or user_id +# If you just provide an email, for example, it will create a new contact +# See https://developers.intercom.com/intercom-api-reference/reference#update-lead for more detail +contact = intercom.contacts.create(email: "some_contact@example.com", id: "3be0398668071a6bc6850413", name:"update_contact") + +# Update a contact (via contact object) contact.custom_attributes['foo'] = 'bar' intercom.contacts.save(contact) # Find contacts by email contacts = intercom.contacts.find_all(email: "some_contact@example.com") @@ -408,11 +419,11 @@ # Convert a contact into a user contact = intercom.contacts.find(id: "536e564f316c83104c000020") intercom.contacts.convert(contact, Intercom::User.new(email: email)) # Using find with email will not work here. See https://github.com/intercom/intercom-ruby/issues/419 for more information -# Delete a contact -intercom.contacts.delete(contact) +# archive a contact +intercom.contacts.archive(contact) # Get a large list of contacts using scroll intercom.contacts.scroll.each { |lead| puts lead.id} # Please see users scroll for more details of how to use scroll ```