The intercom API reference.
The intercom API reference.
A subscription type lets customers easily opt out of non-essential communications without missing what's important to them.
A translation object contains the localised details of a subscription type.
An array of translations objects with the localised version of the subscription type in each available locale within your translation settings.
{ "type": "subscription", "id": "123456", "state": "live", "default_translation": { "name": "Announcements", "description": "Offers, product and feature announcements", "locale": "en" }, "translations": [ { … } ], "consent_type": "opt_in", "content_types": [ "email" ] }
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.
curl -i -X GET \
'https://api.intercom.io/contacts/{contact_id}/subscriptions' \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
-H 'Intercom-Version: 2.11'
{ "type": "list", "data": [ { … }, { … } ] }
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
curl -i -X POST \
'https://api.intercom.io/contacts/{contact_id}/subscriptions' \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
-H 'Content-Type: application/json' \
-H 'Intercom-Version: 2.11' \
-d '{
"id": 108,
"consent_type": "opt_in"
}'
{ "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" ] }
curl -i -X DELETE \
'https://api.intercom.io/contacts/{contact_id}/subscriptions/{id}' \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
-H 'Intercom-Version: 2.11'
{ "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" ] }
curl -i -X GET \
https://api.intercom.io/subscription_types \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
-H 'Intercom-Version: 2.11'
{ "type": "list", "data": [ { … } ] }