Skip to content

Commit 39c0102

Browse files
committed
update version to 2.2.1
1 parent d8c74c4 commit 39c0102

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

README.md

+37-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Additionally, the new version uses Ruby 2.
1919

2020
Using bundler:
2121

22-
gem 'intercom', "~> 2.2.0"
22+
gem 'intercom', "~> 2.2.1"
2323

2424
## Basic Usage
2525

@@ -43,6 +43,9 @@ Resources this API supports:
4343
https://api.intercom.io/conversations
4444
https://api.intercom.io/messages
4545
https://api.intercom.io/counts
46+
https://api.intercom.io/subscriptions
47+
48+
Additionally, the library can handle incoming webhooks from Intercom and convert to `Intercom::` models.
4649

4750
### Examples
4851

@@ -290,6 +293,39 @@ The metadata key values in the example are treated as follows-
290293
- order_number: a Rich Link (value contains 'url' and 'value' keys)
291294
- price: An Amount in US Dollars (value contains 'amount' and 'currency' keys)
292295

296+
### Subscriptions
297+
298+
Subscribe to events in Intercom to receive webhooks.
299+
300+
```ruby
301+
# create a subscription
302+
Intercom::Subscription.create(:url => "http://example.com", :topics => ["user.created"])
303+
304+
# fetch a subscription
305+
Intercom::Subscription.find(:id => "nsub_123456789")
306+
307+
# list subscriptions
308+
Intercom::Subscription.all
309+
```
310+
311+
### Webhooks
312+
313+
```ruby
314+
# create a payload from the notification hash (from json).
315+
payload = Intercom::Notification.new(notification_hash)
316+
317+
payload.type
318+
# => 'user.created'
319+
320+
payload.model_type
321+
# => Intercom::User
322+
323+
user = payload.model
324+
# => Instance of Intercom::User
325+
```
326+
327+
Note that models generated from webhook notifications might differ slightly from models directly acquired via the API. If this presents a problem, calling `payload.load` will load the model from the API using the `id` field.
328+
293329
### Errors
294330
You do not need to deal with the HTTP response from an API call directly. If there is an unsuccessful response then an error that is a subclass of Intercom:Error will be raised. If desired, you can get at the http_code of an Intercom::Error via it's `http_code` method.
295331

changes.txt

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2.2.1
2+
- Webhook Notification support
3+
- Webhook Subscription support
4+
15
2.2.0
26
- Handle blanks on identity attributes (e.g. email) better.
37

lib/intercom/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Intercom #:nodoc:
2-
VERSION = "2.2.0"
2+
VERSION = "2.2.1"
33
end

0 commit comments

Comments
 (0)