Skip to content

Commit acd7d89

Browse files
committed
update readme
1 parent 13947d6 commit acd7d89

File tree

1 file changed

+62
-26
lines changed

1 file changed

+62
-26
lines changed

README.md

Lines changed: 62 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
11
# intercom-ruby
22

3-
Ruby bindings for the Intercom API (https://developers.intercom.io/reference).
3+
[![Circle CI](https://circleci.com/gh/intercom/intercom-ruby.png?style=shield)](https://circleci.com/gh/intercom/intercom-ruby)
4+
[![gem](https://img.shields.io/gem/v/intercom)](https://rubygems.org/gems/intercom)
5+
![Intercom API Version](https://img.shields.io/badge/Intercom%20API%20Version-2.2-blue)
6+
7+
> Ruby bindings for the [Intercom API](https://developers.intercom.io/reference).
8+
9+
## Project Updates
10+
11+
### Maintenance
12+
13+
We're currently building a new team to provide in-depth and dedicated SDK support.
14+
15+
In the meantime, we'll be operating on limited capacity, meaning all pull requests will be evaluated on a best effort basis and will be limited to critical issues.
16+
17+
We'll communicate all relevant updates as we build this new team and support strategy in the coming months.
418

519
[API Documentation](https://developers.intercom.io/docs)
620

721
[Gem Documentation](http://rubydoc.info/github/intercom/intercom-ruby/master/frames)
822

9-
For generating Intercom JavaScript script tags for Rails, please see https://github.com/intercom/intercom-rails.
23+
For generating Intercom JavaScript script tags for Rails, please see [intercom/intercom-rails](https://github.com/intercom/intercom-rails)
1024

1125
## Upgrading information
1226

@@ -16,12 +30,15 @@ This version of the gem is compatible with `Ruby 2.1` and above.
1630

1731
## Installation
1832

19-
20-
gem install intercom
33+
```bash
34+
gem install intercom
35+
```
2136

2237
Using bundler:
2338

24-
gem 'intercom', '~> 4.1'
39+
```bundler
40+
gem 'intercom', '~> 4.1'
41+
```
2542

2643
## Basic Usage
2744

@@ -46,29 +63,31 @@ You can also use the [omniauth-intercom lib](https://github.com/intercom/omniaut
4663

4764
Resources this API supports:
4865

49-
https://api.intercom.io/contacts
50-
https://api.intercom.io/visitors
51-
https://api.intercom.io/companies
52-
https://api.intercom.io/data_attributes
53-
https://api.intercom.io/events
54-
https://api.intercom.io/tags
55-
https://api.intercom.io/notes
56-
https://api.intercom.io/segments
57-
https://api.intercom.io/conversations
58-
https://api.intercom.io/messages
59-
https://api.intercom.io/admins
60-
https://api.intercom.io/teams
61-
https://api.intercom.io/counts
62-
https://api.intercom.io/subscriptions
63-
https://api.intercom.io/jobs
64-
https://api.intercom.io/articles
65-
https://api.intercom.io/help_center/collections
66-
https://api.intercom.io/help_center/sections
67-
66+
```text
67+
https://api.intercom.io/contacts
68+
https://api.intercom.io/visitors
69+
https://api.intercom.io/companies
70+
https://api.intercom.io/data_attributes
71+
https://api.intercom.io/events
72+
https://api.intercom.io/tags
73+
https://api.intercom.io/notes
74+
https://api.intercom.io/segments
75+
https://api.intercom.io/conversations
76+
https://api.intercom.io/messages
77+
https://api.intercom.io/admins
78+
https://api.intercom.io/teams
79+
https://api.intercom.io/counts
80+
https://api.intercom.io/subscriptions
81+
https://api.intercom.io/jobs
82+
https://api.intercom.io/articles
83+
https://api.intercom.io/help_center/collections
84+
https://api.intercom.io/help_center/sections
85+
```
6886

6987
### Examples
7088

7189
#### Contacts
90+
7291
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.
7392

7493
```ruby
@@ -146,6 +165,7 @@ contact.companies.each {|c| p c.name}
146165
```
147166

148167
#### Visitors
168+
149169
```ruby
150170
# Get and update a visitor
151171
visitor = intercom.visitors.find(id: "5dd570e7b1b922452676af23")
@@ -161,6 +181,7 @@ intercom.visitors.convert(visitor, user)
161181
```
162182

163183
#### Companies
184+
164185
```ruby
165186
# Find a company by company_id
166187
company = intercom.companies.find(company_id: "44")
@@ -188,7 +209,9 @@ intercom.companies.scroll.each { |comp| puts comp.name}
188209
```
189210

190211
#### Data Attributes
212+
191213
Data Attributes are a type of metadata used to describe your customer and company models. These include standard and custom attributes.
214+
192215
```ruby
193216
# Create a new custom data attribute
194217
intercom.data_attributes.create({ name: "test_attribute", model: "contact", data_type: "string" })
@@ -212,6 +235,7 @@ customer_attributes_incl_archived.each { |attr| p attr.name }
212235
```
213236

214237
#### Events
238+
215239
```ruby
216240
intercom.events.create(
217241
event_name: "invited-friend",
@@ -257,7 +281,8 @@ intercom.events.create(
257281
)
258282
```
259283

260-
The metadata key values in the example are treated as follows-
284+
The metadata key values in the example are treated as follows:
285+
261286
- order_date: a Date (key ends with '_date')
262287
- stripe_invoice: The identifier of the Stripe invoice (has a 'stripe_invoice' key)
263288
- order_number: a Rich Link (value contains 'url' and 'value' keys)
@@ -266,6 +291,7 @@ The metadata key values in the example are treated as follows-
266291
*NB:* This version of the gem reserves the field name `type` in Event data.
267292

268293
#### Tags
294+
269295
```ruby
270296
# Iterate over all tags
271297
intercom.tags.all.each {|tag| "#{tag.id} - #{tag.name}" }
@@ -279,12 +305,14 @@ tag = intercom.tags.untag(name: 'blue', companies: [{ company_id: "42ea2f1b93891
279305
```
280306

281307
#### Notes
308+
282309
```ruby
283310
# Find a note by id
284311
note = intercom.notes.find(id: "123")
285312
```
286313

287314
#### Segments
315+
288316
```ruby
289317
# Find a segment
290318
segment = intercom.segments.find(id: segment_id)
@@ -294,6 +322,7 @@ intercom.segments.all.each {|segment| puts "id: #{segment.id} name: #{segment.na
294322
```
295323

296324
#### Conversations
325+
297326
```ruby
298327
# Iterate over all conversations for your app
299328
intercom.conversations.all.each { |convo| ... }
@@ -424,13 +453,15 @@ conversation.remove_contact(id: contact.id, admin_id: admin.id)
424453
```
425454

426455
#### Full loading of an embedded entity
456+
427457
```ruby
428458
# Given a conversation with a partial contact, load the full contact. This can be
429459
# done for any entity
430460
intercom.contacts.load(conversation.contacts.first)
431461
```
432462

433463
#### Sending messages
464+
434465
```ruby
435466

436467
# InApp message from admin to user
@@ -497,6 +528,7 @@ intercom.messages.create({
497528
```
498529

499530
#### Admins
531+
500532
```ruby
501533
# Find access token owner (only with Personal Access Token and OAuth)
502534
intercom.admins.me
@@ -507,6 +539,7 @@ intercom.admins.all.each {|admin| puts admin.email }
507539
```
508540

509541
#### Teams
542+
510543
```ruby
511544
# Find a team by id
512545
intercom.teams.find(id: team_id)
@@ -544,6 +577,7 @@ intercom.subscriptions.all
544577
```
545578

546579
#### Articles
580+
547581
```ruby
548582
# Create an article
549583
article = intercom.articles.create(title: "New Article", author_id: "123456")
@@ -577,6 +611,7 @@ intercom.articles.delete(article)
577611
```
578612

579613
#### Collections
614+
580615
```ruby
581616
# Create a collection
582617
collection = intercom.collections.create(name: "New Collection")
@@ -609,6 +644,7 @@ intercom.collections.delete(collection)
609644
```
610645

611646
#### Sections
647+
612648
```ruby
613649
# Create a section
614650
section = intercom.sections.create(name: "New Section", parent_id: "123456")
@@ -674,7 +710,7 @@ intercom.rate_limit_details
674710
You can handle the rate limits yourself but a simple option is to use the handle_rate_limit flag.
675711
This will automatically catch the 429 rate limit exceeded error and wait until the reset time to retry. After three retries a rate limit exception will be raised. Encountering this error frequently may require a revisiting of your usage of the API.
676712

677-
```
713+
```ruby
678714
intercom = Intercom::Client.new(token: ENV['AT'], handle_rate_limit: true)
679715
```
680716

0 commit comments

Comments
 (0)