The intercom API reference.
- Add subscription to a contact
Intercom API (2.11)
Request
You can fetch a list of subscription types that are attached to a contact. These can be subscriptions that a user has 'opted-in' to or has 'opted-out' from, depending on the subscription type. This will return a list of Subscription Type objects that the contact is associated with.
The data property will show a combined list of:
1.Opt-out subscription types that the user has opted-out from. 2.Opt-in subscription types that the user has opted-in to receiving.
- The production API serverhttps://api.intercom.io/contacts/{contact_id}/subscriptions
- The european API serverhttps://api.eu.intercom.io/contacts/{contact_id}/subscriptions
- The australian API serverhttps://api.au.intercom.io/contacts/{contact_id}/subscriptions
- curl
- Node.js
- Ruby
- PHP
- Python
- Java
- Go
- C#
- R
curl -i -X GET \
https://api.intercom.io/contacts/63a07ddf05a32042dffac965/subscriptions \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
-H 'Intercom-Version: 2.11'Successful
A list of subscription type objects associated with the workspace .
The state of the subscription type.
A translation object contains the localised details of a subscription type.
The localised name of the subscription type.
The localised description of the subscription type.
An array of translations objects with the localised version of the subscription type in each available locale within your translation settings.
The localised name of the subscription type.
The localised description of the subscription type.
Describes the type of consent.
{ "type": "list", "data": [ { … }, { … } ] }
Request
You can add a specific subscription to a contact. In Intercom, we have two different subscription types based on user consent - opt-out and opt-in:
1.Attaching a contact to an opt-out subscription type will opt that user out from receiving messages related to that subscription type.
2.Attaching a contact to an opt-in subscription type will opt that user in to receiving messages related to that subscription type.
This will return a subscription type model for the subscription type that was added to the contact.
The unique identifier for the subscription which is given by Intercom
- The production API serverhttps://api.intercom.io/contacts/{contact_id}/subscriptions
- The european API serverhttps://api.eu.intercom.io/contacts/{contact_id}/subscriptions
- The australian API serverhttps://api.au.intercom.io/contacts/{contact_id}/subscriptions
- curl
- Node.js
- Ruby
- PHP
- Python
- Java
- Go
- C#
- R
curl -i -X POST \
https://api.intercom.io/contacts/63a07ddf05a32042dffac965/subscriptions \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
-H 'Content-Type: application/json' \
-H 'Intercom-Version: 2.11' \
-d '{
"id": 108,
"consent_type": "opt_in"
}'Successful
A translation object contains the localised details of a subscription type.
The localised name of the subscription type.
The localised description of the subscription type.
An array of translations objects with the localised version of the subscription type in each available locale within your translation settings.
The localised name of the subscription type.
The localised description of the subscription type.
{ "type": "subscription", "id": "108", "state": "live", "consent_type": "opt_in", "default_translation": { "name": "Newsletters", "description": "Lorem ipsum dolor sit amet", "locale": "en" }, "translations": [ { … } ], "content_types": [ "sms_message" ] }
- The production API serverhttps://api.intercom.io/contacts/{contact_id}/subscriptions/{subscription_id}
- The european API serverhttps://api.eu.intercom.io/contacts/{contact_id}/subscriptions/{subscription_id}
- The australian API serverhttps://api.au.intercom.io/contacts/{contact_id}/subscriptions/{subscription_id}
- curl
- Node.js
- Ruby
- PHP
- Python
- Java
- Go
- C#
- R
curl -i -X DELETE \
https://api.intercom.io/contacts/63a07ddf05a32042dffac965/subscriptions/37846 \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
-H 'Intercom-Version: 2.11'Successful
A translation object contains the localised details of a subscription type.
The localised name of the subscription type.
The localised description of the subscription type.
An array of translations objects with the localised version of the subscription type in each available locale within your translation settings.
The localised name of the subscription type.
The localised description of the subscription type.
{ "type": "subscription", "id": "124", "state": "live", "consent_type": "opt_in", "default_translation": { "name": "Newsletters", "description": "Lorem ipsum dolor sit amet", "locale": "en" }, "translations": [ { … } ], "content_types": [ "sms_message" ] }