Create a Subscription
$ curl https://api.intercom.io/subscriptions \
-XPOST \
-H 'Authorization:Bearer <Your access token>' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' -d'
{
"service_type": "web",
"topics": ["conversation.admin.replied", "user.created"],
"url": "https://example.org/hooks/1"
}'
HTTP/1.1 200 Ok
{
"type": "notification_subscription",
"id": "nsub_6ab4c480-fd8b-11e3-958f-c779cae3e1b3",
"created_at": 1392731331,
"updated_at": 1392731331,
"service_type": "web",
"topics": ["conversation.admin.assigned", "company.created"],
"url": "https://example.org/hooks",
"active": true,
"hub_secret": null
}
Subscription sub = new Subscription();
sub.setUrl(new URI("https://example.org/webhooks/1"));
sub.addTopic(Subscription.Topic.USER_CREATED);
sub.addTopic(Subscription.Topic.USER_TAG_CREATED);
sub.addTopic(Subscription.Topic.COMPANY);
sub.setAppID("pi3243fa:");
Subscription.create(sub);
You can create a new subscription by submitting a POST
to https://api.intercom.io/subscriptions
along with the JSON for the subscription. A maximum of 250 subscriptions can be created through the API.
Attribute | Type | Description |
---|---|---|
service_type | string | The type of the service being called. Default is web for a plain webhook, which is the only accepted value currently. Defaults to web if not sent. |
url | string | Required. The url the event should be sent to. Required depending on the service type. |
topics | array | Required. An array of topics to subscribe to. |
hub_secret | string | Optional. A key used to sign notifications. |
The response will contain the id
of the subscription.
The ping
topic is always subscribed to and cannot be unsubscribed from. The API may send a ping
event during or soon after creation. By default the subscription is treated as active.
Create a Subscription in Developer Hub Dashboard
You can create webhooks via the Dashboard in your developer tools. To create, edit and troubleshoot a webhook, you can go to the 'Webhooks' section of this dashboard.
Internet Explorer 11 (IE11)
Customers have reported issues when trying to create webhooks using IE11 including not being able to click on the create button. We have confirmed that there are no such issues with chrome or firefox so please use these to setup your webhooks if you do encounter any problems.
Improperly formatted URL
When this occurs you will see a HTTP 500 error with the following message:
“Server Error.” Check your URL
![webhooks dashboard-01.png 8000](https://files.readme.io/5394e52-webhooks_dashboard-01.png)