README.md in intercom-4.0.0 vs README.md in intercom-4.0.1

- old
+ new

@@ -59,12 +59,12 @@ https://api.intercom.io/admins https://api.intercom.io/teams https://api.intercom.io/counts https://api.intercom.io/subscriptions https://api.intercom.io/jobs - + ### Examples #### Contacts Note that this is a new resource compatible only with the new [Contacts API](https://developers.intercom.com/intercom-api-reference/reference#contacts-model) released in API v2.0. @@ -97,11 +97,11 @@ "operator": '=', "value": 'some_contact@example.com' } ) contacts.each {|c| p c.email} -# For full detail on possible queries, please refer to the API documentation: +# For full detail on possible queries, please refer to the API documentation: # https://developers.intercom.com/intercom-api-reference/reference # Merge a lead into an existing user lead = intercom.contacts.create(email: "some_contact2@example.com", role: "lead") intercom.contacts.merge(lead, intercom.contacts.find(id: "5db2e80ab1b92243d2188cfe")) @@ -189,11 +189,11 @@ # Archive an attribute attribute.archived = true intercom.data_attributes.save(attribute) -# Find all customer attributes including archived +# Find all customer attributes including archived customer_attributes_incl_archived = intercom.data_attributes.find_all({"model": "contact", "include_archived": true}) customer_attributes_incl_archived.each { |attr| p attribute.name } ``` #### Events @@ -319,11 +319,11 @@ # Get statistics related to the conversation conversation.statistics.time_to_admin_reply conversation.statistics.last_assignment_at # Get information on the sla applied to a conversation -conversation.sla_applied.sla_name +conversation.sla_applied.sla_name # REPLYING TO CONVERSATIONS # User (identified by email) replies with a comment intercom.conversations.reply(id: conversation.id, type: 'user', email: 'joe@example.com', message_type: 'comment', body: 'foo') # Admin (identified by id) replies with a comment @@ -368,13 +368,13 @@ # RUN ASSIGNMENT RULES intercom.conversations.run_assignment_rules(conversation.id) # Search for conversations -# For full detail on possible queries, please refer to the API documentation: -# https://developers.intercom.com/intercom-api-reference/reference - +# For full detail on possible queries, please refer to the API documentation: +# https://developers.intercom.com/intercom-api-reference/reference + # Search for open conversations sorted by the created_at date conversations = intercom.conversations.search( query: { field: "open", operator: "=", @@ -384,21 +384,26 @@ sort_order: "descending" ) conversations.each {|c| p c.id} # Tagging for conversations -tag = intercom.tags.find(id: "2") +tag = intercom.tags.find(id: "2") conversation = intercom.conversations.find(id: "1") # An Admin ID is required to add or remove tag on a conversation -admin = intercom.admins.find(id: "1") +admin = intercom.admins.find(id: "1") # Add a tag to a conversation conversation.add_tag(id: tag.id, admin_id: admin.id) # Remove a tag from a conversation conversation.remove_tag(id: tag.id, admin_id: admin.id) - + +# Add a contact to a conversation +conversation.add_contact(admin_id: admin.id, customer: { intercom_user_id: contact.id }) + +# Remove a contact from a conversation +conversation.remove_contact(id: contact.id, admin_id: admin.id) ``` #### Full loading of an embedded entity ```ruby # Given a conversation with a partial contact, load the full contact. This can be