Skip to content

Latest commit

Β 

History

History
7819 lines (5542 loc) Β· 126 KB

reference.md

File metadata and controls

7819 lines (5542 loc) Β· 126 KB

Reference

Admins

client.admins.identify() -> Intercom.AdminWithApp

πŸ“ Description

You can view the currently authorised admin along with the embedded app object (a "workspace" in legacy terminology).

🚧 Single Sign On

If you are building a custom "Log in with Intercom" flow for your site, and you call the /me endpoint to identify the logged-in user, you should not accept any sign-ins from users with unverified email addresses as it poses a potential impersonation security risk.

πŸ”Œ Usage

await client.admins.identify();

βš™οΈ Parameters

requestOptions: Admins.RequestOptions

client.admins.away({ ...params }) -> Intercom.Admin

πŸ“ Description

You can set an Admin as away for the Inbox.

πŸ”Œ Usage

await client.admins.away({
    admin_id: "admin_id",
    away_mode_enabled: true,
    away_mode_reassign: true,
});

βš™οΈ Parameters

request: Intercom.ConfigureAwayAdminRequest

requestOptions: Admins.RequestOptions

client.admins.listAllActivityLogs({ ...params }) -> Intercom.ActivityLogList

πŸ“ Description

You can get a log of activities by all admins in an app.

πŸ”Œ Usage

await client.admins.listAllActivityLogs({
    created_at_after: "1677253093",
    created_at_before: "1677861493",
});

βš™οΈ Parameters

request: Intercom.ListAllActivityLogsRequest

requestOptions: Admins.RequestOptions

client.admins.list() -> Intercom.AdminList

πŸ“ Description

You can fetch a list of admins for a given workspace.

πŸ”Œ Usage

await client.admins.list();

βš™οΈ Parameters

requestOptions: Admins.RequestOptions

client.admins.find({ ...params }) -> Intercom.Admin

πŸ“ Description

You can retrieve the details of a single admin.

πŸ”Œ Usage

await client.admins.find({
    admin_id: "123",
});

βš™οΈ Parameters

request: Intercom.FindAdminRequest

requestOptions: Admins.RequestOptions

Articles

client.articles.list({ ...params }) -> core.Page

πŸ“ Description

You can fetch a list of all articles by making a GET request to https://api.intercom.io/articles.

πŸ“˜ How are the articles sorted and ordered?

Articles will be returned in descending order on the updated_at attribute. This means if you need to iterate through results then we'll show the most recently updated articles first.

πŸ”Œ Usage

const response = await client.articles.list();
for await (const item of response) {
    console.log(item);
}

// Or you can manually iterate page-by-page
const page = await client.articles.list();
while (page.hasNextPage()) {
    page = page.getNextPage();
}

βš™οΈ Parameters

request: Intercom.ListArticlesRequest

requestOptions: Articles.RequestOptions

client.articles.create({ ...params }) -> Intercom.Article

πŸ“ Description

You can create a new article by making a POST request to https://api.intercom.io/articles.

πŸ”Œ Usage

await client.articles.create({
    title: "Thanks for everything",
    description: "Description of the Article",
    body: "Body of the Article",
    author_id: 991267407,
    state: "published",
    parent_id: 145,
    parent_type: "collection",
    translated_content: {
        fr: {
            type: "article_content",
            title: "Merci pour tout",
            description: "Description de l'article",
            body: "Corps de l'article",
            author_id: 991267407,
            state: "published",
        },
    },
});

βš™οΈ Parameters

request: Intercom.CreateArticleRequest

requestOptions: Articles.RequestOptions

client.articles.find({ ...params }) -> Intercom.Article

πŸ“ Description

You can fetch the details of a single article by making a GET request to https://api.intercom.io/articles/<id>.

πŸ”Œ Usage

await client.articles.find({
    article_id: "123",
});

βš™οΈ Parameters

request: Intercom.FindArticleRequest

requestOptions: Articles.RequestOptions

client.articles.update({ ...params }) -> Intercom.Article

πŸ“ Description

You can update the details of a single article by making a PUT request to https://api.intercom.io/articles/<id>.

πŸ”Œ Usage

await client.articles.update({
    article_id: "123",
    title: "Christmas is here!",
    body: "<p>New gifts in store for the jolly season</p>",
});

βš™οΈ Parameters

request: Intercom.UpdateArticleRequest

requestOptions: Articles.RequestOptions

client.articles.delete({ ...params }) -> Intercom.DeletedArticleObject

πŸ“ Description

You can delete a single article by making a DELETE request to https://api.intercom.io/articles/<id>.

πŸ”Œ Usage

await client.articles.delete({
    article_id: "123",
});

βš™οΈ Parameters

request: Intercom.DeleteArticleRequest

requestOptions: Articles.RequestOptions

client.articles.search({ ...params }) -> Intercom.SearchArticlesResponse

πŸ“ Description

You can search for articles by making a GET request to https://api.intercom.io/articles/search.

πŸ”Œ Usage

await client.articles.search({
    phrase: "Getting started",
    state: "published",
});

βš™οΈ Parameters

request: Intercom.SearchArticlesRequest

requestOptions: Articles.RequestOptions

HelpCenters

client.helpCenters.find({ ...params }) -> Intercom.HelpCenter

πŸ“ Description

You can fetch the details of a single Help Center by making a GET request to https://api.intercom.io/help_center/help_center/<id>.

πŸ”Œ Usage

await client.helpCenters.find({
    help_center_id: "123",
});

βš™οΈ Parameters

request: Intercom.FindHelpCenterRequest

requestOptions: HelpCenters.RequestOptions

client.helpCenters.list({ ...params }) -> core.Page

πŸ“ Description

You can list all Help Centers by making a GET request to https://api.intercom.io/help_center/help_centers.

πŸ”Œ Usage

const response = await client.helpCenters.list();
for await (const item of response) {
    console.log(item);
}

// Or you can manually iterate page-by-page
const page = await client.helpCenters.list();
while (page.hasNextPage()) {
    page = page.getNextPage();
}

βš™οΈ Parameters

request: Intercom.ListHelpCentersRequest

requestOptions: HelpCenters.RequestOptions

Companies

client.companies.retrieve({ ...params }) -> Intercom.CompanyList

πŸ“ Description

You can fetch a single company by passing in company_id or name.

https://api.intercom.io/companies?name={name}

https://api.intercom.io/companies?company_id={company_id}

You can fetch all companies and filter by segment_id or tag_id as a query parameter.

https://api.intercom.io/companies?tag_id={tag_id}

https://api.intercom.io/companies?segment_id={segment_id}

πŸ”Œ Usage

await client.companies.retrieve({
    name: "my company",
    company_id: "12345",
    tag_id: "678910",
    segment_id: "98765",
});

βš™οΈ Parameters

request: Intercom.RetrieveCompanyRequest

requestOptions: Companies.RequestOptions

client.companies.createOrUpdate({ ...params }) -> Intercom.Company

πŸ“ Description

You can create or update a company.

Companies will be only visible in Intercom when there is at least one associated user.

Companies are looked up via company_id in a POST request, if not found via company_id, the new company will be created, if found, that company will be updated.

{% admonition type="attention" name="Using company_id" %} You can set a unique company_id value when creating a company. However, it is not possible to update company_id. Be sure to set a unique value once upon creation of the company. {% /admonition %}

πŸ”Œ Usage

await client.companies.createOrUpdate({
    name: "my company",
    company_id: "company_remote_id",
    remote_created_at: 1374138000,
});

βš™οΈ Parameters

request: Intercom.CreateOrUpdateCompanyRequest

requestOptions: Companies.RequestOptions

client.companies.find({ ...params }) -> Intercom.Company

πŸ“ Description

You can fetch a single company.

πŸ”Œ Usage

await client.companies.find({
    company_id: "5f4d3c1c-7b1b-4d7d-a97e-6095715c6632",
});

βš™οΈ Parameters

request: Intercom.FindCompanyRequest

requestOptions: Companies.RequestOptions

client.companies.update({ ...params }) -> Intercom.Company

πŸ“ Description

You can update a single company using the Intercom provisioned id.

{% admonition type="attention" name="Using company_id" %} When updating a company it is not possible to update company_id. This can only be set once upon creation of the company. {% /admonition %}

πŸ”Œ Usage

await client.companies.update({
    company_id: "5f4d3c1c-7b1b-4d7d-a97e-6095715c6632",
});

βš™οΈ Parameters

request: Intercom.UpdateCompanyRequest

requestOptions: Companies.RequestOptions

client.companies.delete({ ...params }) -> Intercom.DeletedCompanyObject

πŸ“ Description

You can delete a single company.

πŸ”Œ Usage

await client.companies.delete({
    company_id: "5f4d3c1c-7b1b-4d7d-a97e-6095715c6632",
});

βš™οΈ Parameters

request: Intercom.DeleteCompanyRequest

requestOptions: Companies.RequestOptions

client.companies.listAttachedContacts({ ...params }) -> Intercom.CompanyAttachedContacts

πŸ“ Description

You can fetch a list of all contacts that belong to a company.

πŸ”Œ Usage

await client.companies.listAttachedContacts({
    company_id: "5f4d3c1c-7b1b-4d7d-a97e-6095715c6632",
});

βš™οΈ Parameters

request: Intercom.ListAttachedContactsRequest

requestOptions: Companies.RequestOptions

client.companies.listAttachedSegments({ ...params }) -> Intercom.CompanyAttachedSegments

πŸ“ Description

You can fetch a list of all segments that belong to a company.

πŸ”Œ Usage

await client.companies.listAttachedSegments({
    company_id: "5f4d3c1c-7b1b-4d7d-a97e-6095715c6632",
});

βš™οΈ Parameters

request: Intercom.ListSegmentsAttachedToCompanyRequest

requestOptions: Companies.RequestOptions

client.companies.list({ ...params }) -> core.Page

πŸ“ Description

You can list companies. The company list is sorted by the last_request_at field and by default is ordered descending, most recently requested first.

Note that the API does not include companies who have no associated users in list responses.

When using the Companies endpoint and the pages object to iterate through the returned companies, there is a limit of 10,000 Companies that can be returned. If you need to list or iterate on more than 10,000 Companies, please use the Scroll API. {% admonition type="warning" name="Pagination" %} You can use pagination to limit the number of results returned. The default is 20 results per page. See the pagination section for more details on how to use the starting_after param. {% /admonition %}

πŸ”Œ Usage

const response = await client.companies.list({
    order: "desc",
});
for await (const item of response) {
    console.log(item);
}

// Or you can manually iterate page-by-page
const page = await client.companies.list({
    order: "desc",
});
while (page.hasNextPage()) {
    page = page.getNextPage();
}

βš™οΈ Parameters

request: Intercom.ListCompaniesRequest

requestOptions: Companies.RequestOptions

client.companies.scroll({ ...params }) -> core.Page

πŸ“ Description

  The `list all companies` functionality does not work well for huge datasets, and can result in errors and performance problems when paging deeply. The Scroll API provides an efficient mechanism for iterating over all companies in a dataset.
  • Each app can only have 1 scroll open at a time. You'll get an error message if you try to have more than one open per app.
  • If the scroll isn't used for 1 minute, it expires and calls with that scroll param will fail
  • If the end of the scroll is reached, "companies" will be empty and the scroll parameter will expire

{% admonition type="info" name="Scroll Parameter" %} You can get the first page of companies by simply sending a GET request to the scroll endpoint. For subsequent requests you will need to use the scroll parameter from the response. {% /admonition %} {% admonition type="danger" name="Scroll network timeouts" %} Since scroll is often used on large datasets network errors such as timeouts can be encountered. When this occurs you will see a HTTP 500 error with the following message: "Request failed due to an internal network error. Please restart the scroll operation." If this happens, you will need to restart your scroll query: It is not possible to continue from a specific point when using scroll. {% /admonition %}

πŸ”Œ Usage

const response = await client.companies.scroll();
for await (const item of response) {
    console.log(item);
}

// Or you can manually iterate page-by-page
const page = await client.companies.scroll();
while (page.hasNextPage()) {
    page = page.getNextPage();
}

βš™οΈ Parameters

request: Intercom.ScrollCompaniesRequest

requestOptions: Companies.RequestOptions

client.companies.attachContact({ ...params }) -> Intercom.Company

πŸ“ Description

You can attach a company to a single contact.

πŸ”Œ Usage

await client.companies.attachContact({
    contact_id: "contact_id",
    id: "667d608d8a68186f43bafd70",
});

βš™οΈ Parameters

request: Intercom.AttachContactToCompanyRequest

requestOptions: Companies.RequestOptions

client.companies.detachContact({ ...params }) -> Intercom.Company

πŸ“ Description

You can detach a company from a single contact.

πŸ”Œ Usage

await client.companies.detachContact({
    contact_id: "58a430d35458202d41b1e65b",
    company_id: "58a430d35458202d41b1e65b",
});

βš™οΈ Parameters

request: Intercom.DetachContactFromCompanyRequest

requestOptions: Companies.RequestOptions

Contacts

client.contacts.listAttachedCompanies({ ...params }) -> core.Page

πŸ“ Description

You can fetch a list of companies that are associated to a contact.

πŸ”Œ Usage

const response = await client.contacts.listAttachedCompanies({
    contact_id: "63a07ddf05a32042dffac965",
});
for await (const item of response) {
    console.log(item);
}

// Or you can manually iterate page-by-page
const page = await client.contacts.listAttachedCompanies({
    contact_id: "63a07ddf05a32042dffac965",
});
while (page.hasNextPage()) {
    page = page.getNextPage();
}

βš™οΈ Parameters

request: Intercom.ListAttachedCompaniesRequest

requestOptions: Contacts.RequestOptions

client.contacts.listAttachedSegments({ ...params }) -> Intercom.ContactSegments

πŸ“ Description

You can fetch a list of segments that are associated to a contact.

πŸ”Œ Usage

await client.contacts.listAttachedSegments({
    contact_id: "63a07ddf05a32042dffac965",
});

βš™οΈ Parameters

request: Intercom.ListSegmentsAttachedToContactRequest

requestOptions: Contacts.RequestOptions

client.contacts.listAttachedSubscriptions({ ...params }) -> Intercom.SubscriptionTypeList

πŸ“ Description

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.

πŸ”Œ Usage

await client.contacts.listAttachedSubscriptions({
    contact_id: "63a07ddf05a32042dffac965",
});

βš™οΈ Parameters

request: Intercom.ListAttachedSubscriptionsRequest

requestOptions: Contacts.RequestOptions

client.contacts.attachSubscription({ ...params }) -> Intercom.SubscriptionType

πŸ“ Description

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.

πŸ”Œ Usage

await client.contacts.attachSubscription({
    contact_id: "63a07ddf05a32042dffac965",
    id: "37846",
    consent_type: "opt_in",
});

βš™οΈ Parameters

request: Intercom.AttachSubscriptionToContactRequest

requestOptions: Contacts.RequestOptions

client.contacts.detachSubscription({ ...params }) -> Intercom.SubscriptionType

πŸ“ Description

You can remove a specific subscription from a contact. This will return a subscription type model for the subscription type that was removed from the contact.

πŸ”Œ Usage

await client.contacts.detachSubscription({
    contact_id: "63a07ddf05a32042dffac965",
    subscription_id: "37846",
});

βš™οΈ Parameters

request: Intercom.DetachSubscriptionFromContactRequest

requestOptions: Contacts.RequestOptions

client.contacts.listAttachedTags({ ...params }) -> Intercom.TagList

πŸ“ Description

You can fetch a list of all tags that are attached to a specific contact.

πŸ”Œ Usage

await client.contacts.listAttachedTags({
    contact_id: "63a07ddf05a32042dffac965",
});

βš™οΈ Parameters

request: Intercom.ListTagsAttachedToContactRequest

requestOptions: Contacts.RequestOptions

client.contacts.find({ ...params }) -> Intercom.Contact

πŸ“ Description

You can fetch the details of a single contact.

πŸ”Œ Usage

await client.contacts.find({
    contact_id: "63a07ddf05a32042dffac965",
});

βš™οΈ Parameters

request: Intercom.FindContactRequest

requestOptions: Contacts.RequestOptions

client.contacts.update({ ...params }) -> Intercom.Contact

πŸ“ Description

You can update an existing contact (ie. user or lead).

πŸ”Œ Usage

await client.contacts.update({
    contact_id: "63a07ddf05a32042dffac965",
    email: "joebloggs@intercom.io",
    name: "joe bloggs",
});

βš™οΈ Parameters

request: Intercom.UpdateContactRequest

requestOptions: Contacts.RequestOptions

client.contacts.delete({ ...params }) -> Intercom.ContactDeleted

πŸ“ Description

You can delete a single contact.

πŸ”Œ Usage

await client.contacts.delete({
    contact_id: "contact_id",
});

βš™οΈ Parameters

request: Intercom.DeleteContactRequest

requestOptions: Contacts.RequestOptions

client.contacts.mergeLeadInUser({ ...params }) -> Intercom.Contact

πŸ“ Description

You can merge a contact with a role of lead into a contact with a role of user.

πŸ”Œ Usage

await client.contacts.mergeLeadInUser({
    from: "667d60ac8a68186f43bafdbb",
    into: "667d60ac8a68186f43bafdbc",
});

βš™οΈ Parameters

request: Intercom.MergeContactsRequest

requestOptions: Contacts.RequestOptions

client.contacts.search({ ...params }) -> core.Page

πŸ“ Description

You can search for multiple contacts by the value of their attributes in order to fetch exactly who you want.

To search for contacts, you need to send a POST request to https://api.intercom.io/contacts/search.

This will accept a query object in the body which will define your filters in order to search for contacts.

{% admonition type="warning" name="Optimizing search queries" %} Search queries can be complex, so optimizing them can help the performance of your search. Use the AND and OR operators to combine multiple filters to get the exact results you need and utilize pagination to limit the number of results returned. The default is 50 results per page. See the pagination section for more details on how to use the starting_after param. {% /admonition %}

Contact Creation Delay

If a contact has recently been created, there is a possibility that it will not yet be available when searching. This means that it may not appear in the response. This delay can take a few minutes. If you need to be instantly notified it is recommended to use webhooks and iterate to see if they match your search filters.

Nesting & Limitations

You can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4). There are some limitations to the amount of multiple's there can be:

  • There's a limit of max 2 nested filters
  • There's a limit of max 15 filters for each AND or OR group

Searching for Timestamp Fields

All timestamp fields (created_at, updated_at etc.) are indexed as Dates for Contact Search queries; Datetime queries are not currently supported. This means you can only query for timestamp fields by day - not hour, minute or second. For example, if you search for all Contacts with a created_at value greater (>) than 1577869200 (the UNIX timestamp for January 1st, 2020 9:00 AM), that will be interpreted as 1577836800 (January 1st, 2020 12:00 AM). The search results will then include Contacts created from January 2nd, 2020 12:00 AM onwards. If you'd like to get contacts created on January 1st, 2020 you should search with a created_at value equal (=) to 1577836800 (January 1st, 2020 12:00 AM). This behaviour applies only to timestamps used in search queries. The search results will still contain the full UNIX timestamp and be sorted accordingly.

Accepted Fields

Most key listed as part of the Contacts Model are searchable, whether writeable or not. The value you search for has to match the accepted type, otherwise the query will fail (ie. as created_at accepts a date, the value cannot be a string such as "foorbar").

Field Type
id String
role String
Accepts user or lead
name String
avatar String
owner_id Integer
email String
email_domain String
phone String
formatted_phone String
external_id String
created_at Date (UNIX Timestamp)
signed_up_at Date (UNIX Timestamp)
updated_at Date (UNIX Timestamp)
last_seen_at Date (UNIX Timestamp)
last_contacted_at Date (UNIX Timestamp)
last_replied_at Date (UNIX Timestamp)
last_email_opened_at Date (UNIX Timestamp)
last_email_clicked_at Date (UNIX Timestamp)
language_override String
browser String
browser_language String
os String
location.country String
location.region String
location.city String
unsubscribed_from_emails Boolean
marked_email_as_spam Boolean
has_hard_bounced Boolean
ios_last_seen_at Date (UNIX Timestamp)
ios_app_version String
ios_device String
ios_app_device String
ios_os_version String
ios_app_name String
ios_sdk_version String
android_last_seen_at Date (UNIX Timestamp)
android_app_version String
android_device String
android_app_name String
andoid_sdk_version String
segment_id String
tag_id String
custom_attributes.{attribute_name} String

Accepted Operators

{% admonition type="attention" name="Searching based on created_at" %} You cannot use the <= or >= operators to search by created_at. {% /admonition %}

The table below shows the operators you can use to define how you want to search for the value. The operator should be put in as a string ("="). The operator has to be compatible with the field's type (eg. you cannot search with > for a given string value as it's only compatible for integer's and dates).

Operator Valid Types Description
= All Equals
!= All Doesn't Equal
IN All In
Shortcut for OR queries
Values must be in Array
NIN All Not In
Shortcut for OR ! queries
Values must be in Array
> Integer
Date (UNIX Timestamp)
Greater than
< Integer
Date (UNIX Timestamp)
Lower than
~ String Contains
!~ String Doesn't Contain
^ String Starts With
$ String Ends With

πŸ”Œ Usage

const response = await client.contacts.search({
    query: {
        operator: "AND",
        value: [
            {
                field: "created_at",
                operator: ">",
                value: "1306054154",
            },
        ],
    },
    pagination: {
        per_page: 5,
    },
});
for await (const item of response) {
    console.log(item);
}

// Or you can manually iterate page-by-page
const page = await client.contacts.search({
    query: {
        operator: "AND",
        value: [
            {
                field: "created_at",
                operator: ">",
                value: "1306054154",
            },
        ],
    },
    pagination: {
        per_page: 5,
    },
});
while (page.hasNextPage()) {
    page = page.getNextPage();
}

βš™οΈ Parameters

request: Intercom.SearchRequest

requestOptions: Contacts.RequestOptions

client.contacts.list({ ...params }) -> core.Page

πŸ“ Description

You can fetch a list of all contacts (ie. users or leads) in your workspace. {% admonition type="warning" name="Pagination" %} You can use pagination to limit the number of results returned. The default is 50 results per page. See the pagination section for more details on how to use the starting_after param. {% /admonition %}

πŸ”Œ Usage

const response = await client.contacts.list();
for await (const item of response) {
    console.log(item);
}

// Or you can manually iterate page-by-page
const page = await client.contacts.list();
while (page.hasNextPage()) {
    page = page.getNextPage();
}

βš™οΈ Parameters

request: Intercom.ListContactsRequest

requestOptions: Contacts.RequestOptions

client.contacts.create({ ...params }) -> Intercom.Contact

πŸ“ Description

You can create a new contact (ie. user or lead).

πŸ”Œ Usage

await client.contacts.create({
    email: "joebloggs@intercom.io",
});

βš™οΈ Parameters

request: Intercom.CreateContactRequest

requestOptions: Contacts.RequestOptions

client.contacts.archive({ ...params }) -> Intercom.ContactArchived

πŸ“ Description

You can archive a single contact.

πŸ”Œ Usage

await client.contacts.archive({
    contact_id: "63a07ddf05a32042dffac965",
});

βš™οΈ Parameters

request: Intercom.ArchiveContactRequest

requestOptions: Contacts.RequestOptions

client.contacts.unarchive({ ...params }) -> Intercom.ContactUnarchived

πŸ“ Description

You can unarchive a single contact.

πŸ”Œ Usage

await client.contacts.unarchive({
    contact_id: "63a07ddf05a32042dffac965",
});

βš™οΈ Parameters

request: Intercom.UnarchiveContactRequest

requestOptions: Contacts.RequestOptions

Notes

client.notes.list({ ...params }) -> core.Page

πŸ“ Description

You can fetch a list of notes that are associated to a contact.

πŸ”Œ Usage

const response = await client.notes.list({
    contact_id: "contact_id",
});
for await (const item of response) {
    console.log(item);
}

// Or you can manually iterate page-by-page
const page = await client.notes.list({
    contact_id: "contact_id",
});
while (page.hasNextPage()) {
    page = page.getNextPage();
}

βš™οΈ Parameters

request: Intercom.ListContactNotesRequest

requestOptions: Notes.RequestOptions

client.notes.create({ ...params }) -> Intercom.Note

πŸ“ Description

You can add a note to a single contact.

πŸ”Œ Usage

await client.notes.create({
    contact_id: "123",
    body: "Hello",
    admin_id: "123",
});

βš™οΈ Parameters

request: Intercom.CreateContactNoteRequest

requestOptions: Notes.RequestOptions

client.notes.find({ ...params }) -> Intercom.Note

πŸ“ Description

You can fetch the details of a single note.

πŸ”Œ Usage

await client.notes.find({
    note_id: "1",
});

βš™οΈ Parameters

request: Intercom.FindNoteRequest

requestOptions: Notes.RequestOptions

Tags

client.tags.tagContact({ ...params }) -> Intercom.Tag

πŸ“ Description

You can tag a specific contact. This will return a tag object for the tag that was added to the contact.

πŸ”Œ Usage

await client.tags.tagContact({
    contact_id: "63a07ddf05a32042dffac965",
    id: "7522907",
});

βš™οΈ Parameters

request: Intercom.TagContactRequest

requestOptions: Tags.RequestOptions

client.tags.untagContact({ ...params }) -> Intercom.Tag

πŸ“ Description

You can remove tag from a specific contact. This will return a tag object for the tag that was removed from the contact.

πŸ”Œ Usage

await client.tags.untagContact({
    contact_id: "63a07ddf05a32042dffac965",
    tag_id: "7522907",
});

βš™οΈ Parameters

request: Intercom.UntagContactRequest

requestOptions: Tags.RequestOptions

client.tags.tagConversation({ ...params }) -> Intercom.Tag

πŸ“ Description

You can tag a specific conversation. This will return a tag object for the tag that was added to the conversation.

πŸ”Œ Usage

await client.tags.tagConversation({
    conversation_id: "64619700005694",
    id: "7522907",
    admin_id: "780",
});

βš™οΈ Parameters

request: Intercom.TagConversationRequest

requestOptions: Tags.RequestOptions

client.tags.untagConversation({ ...params }) -> Intercom.Tag

πŸ“ Description

You can remove tag from a specific conversation. This will return a tag object for the tag that was removed from the conversation.

πŸ”Œ Usage

await client.tags.untagConversation({
    conversation_id: "64619700005694",
    tag_id: "7522907",
    admin_id: "123",
});

βš™οΈ Parameters

request: Intercom.UntagConversationRequest

requestOptions: Tags.RequestOptions

client.tags.list() -> Intercom.TagList

πŸ“ Description

You can fetch a list of all tags for a given workspace.

πŸ”Œ Usage

await client.tags.list();

βš™οΈ Parameters

requestOptions: Tags.RequestOptions

client.tags.create({ ...params }) -> Intercom.Tag

πŸ“ Description

You can use this endpoint to perform the following operations:

1. Create a new tag: You can create a new tag by passing in the tag name as specified in "Create or Update Tag Request Payload" described below.

2. Update an existing tag: You can update an existing tag by passing the id of the tag as specified in "Create or Update Tag Request Payload" described below.

3. Tag Companies: You can tag single company or a list of companies. You can tag a company by passing in the tag name and the company details as specified in "Tag Company Request Payload" described below. Also, if the tag doesn't exist then a new one will be created automatically.

4. Untag Companies: You can untag a single company or a list of companies. You can untag a company by passing in the tag id and the company details as specified in "Untag Company Request Payload" described below.

5. Tag Multiple Users: You can tag a list of users. You can tag the users by passing in the tag name and the user details as specified in "Tag Users Request Payload" described below.

Each operation will return a tag object.

πŸ”Œ Usage

await client.tags.create({
    name: "test",
});

βš™οΈ Parameters

request: Intercom.TagsCreateRequestBody

requestOptions: Tags.RequestOptions

client.tags.find({ ...params }) -> Intercom.Tag

πŸ“ Description

You can fetch the details of tags that are on the workspace by their id. This will return a tag object.

πŸ”Œ Usage

await client.tags.find({
    tag_id: "123",
});

βš™οΈ Parameters

request: Intercom.FindTagRequest

requestOptions: Tags.RequestOptions

client.tags.delete({ ...params }) -> void

πŸ“ Description

You can delete the details of tags that are on the workspace by passing in the id.

πŸ”Œ Usage

await client.tags.delete({
    tag_id: "123",
});

βš™οΈ Parameters

request: Intercom.DeleteTagRequest

requestOptions: Tags.RequestOptions

client.tags.tagTicket({ ...params }) -> Intercom.Tag

πŸ“ Description

You can tag a specific ticket. This will return a tag object for the tag that was added to the ticket.

πŸ”Œ Usage

await client.tags.tagTicket({
    ticket_id: "64619700005694",
    id: "7522907",
    admin_id: "780",
});

βš™οΈ Parameters

request: Intercom.TagTicketRequest

requestOptions: Tags.RequestOptions

client.tags.untagTicket({ ...params }) -> Intercom.Tag

πŸ“ Description

You can remove tag from a specific ticket. This will return a tag object for the tag that was removed from the ticket.

πŸ”Œ Usage

await client.tags.untagTicket({
    ticket_id: "64619700005694",
    tag_id: "7522907",
    admin_id: "123",
});

βš™οΈ Parameters

request: Intercom.UntagTicketRequest

requestOptions: Tags.RequestOptions

Conversations

client.conversations.list({ ...params }) -> core.Page

πŸ“ Description

You can fetch a list of all conversations.

You can optionally request the result page size and the cursor to start after to fetch the result. {% admonition type="warning" name="Pagination" %} You can use pagination to limit the number of results returned. The default is 20 results per page. See the pagination section for more details on how to use the starting_after param. {% /admonition %}

πŸ”Œ Usage

const response = await client.conversations.list();
for await (const item of response) {
    console.log(item);
}

// Or you can manually iterate page-by-page
const page = await client.conversations.list();
while (page.hasNextPage()) {
    page = page.getNextPage();
}

βš™οΈ Parameters

request: Intercom.ListConversationsRequest

requestOptions: Conversations.RequestOptions

client.conversations.create({ ...params }) -> Intercom.Message

πŸ“ Description

You can create a conversation that has been initiated by a contact (ie. user or lead). The conversation can be an in-app message only.

{% admonition type="info" name="Sending for visitors" %} You can also send a message from a visitor by specifying their user_id or id value in the from field, along with a type field value of contact. This visitor will be automatically converted to a contact with a lead role once the conversation is created. {% /admonition %}

This will return the Message model that has been created.

πŸ”Œ Usage

await client.conversations.create({
    from: {
        type: "user",
        id: "667d60d18a68186f43bafddd",
    },
    body: "Hello there",
});

βš™οΈ Parameters

request: Intercom.CreateConversationRequest

requestOptions: Conversations.RequestOptions

client.conversations.find({ ...params }) -> Intercom.Conversation

πŸ“ Description

You can fetch the details of a single conversation.

This will return a single Conversation model with all its conversation parts.

{% admonition type="warning" name="Hard limit of 500 parts" %} The maximum number of conversation parts that can be returned via the API is 500. If you have more than that we will return the 500 most recent conversation parts. {% /admonition %}

For AI agent conversation metadata, please note that you need to have the agent enabled in your workspace, which is a paid feature.

πŸ”Œ Usage

await client.conversations.find({
    conversation_id: "123",
    display_as: "plaintext",
});

βš™οΈ Parameters

request: Intercom.FindConversationRequest

requestOptions: Conversations.RequestOptions

client.conversations.update({ ...params }) -> Intercom.Conversation

πŸ“ Description

You can update an existing conversation.

{% admonition type="info" name="Replying and other actions" %} If you want to reply to a coveration or take an action such as assign, unassign, open, close or snooze, take a look at the reply and manage endpoints. {% /admonition %}

πŸ”Œ Usage

await client.conversations.update({
    conversation_id: "123",
    display_as: "plaintext",
    read: true,
    custom_attributes: {
        issue_type: "Billing",
        priority: "High",
    },
});

βš™οΈ Parameters

request: Intercom.UpdateConversationRequest

requestOptions: Conversations.RequestOptions

client.conversations.search({ ...params }) -> core.Page

πŸ“ Description

You can search for multiple conversations by the value of their attributes in order to fetch exactly which ones you want.

To search for conversations, you need to send a POST request to https://api.intercom.io/conversations/search.

This will accept a query object in the body which will define your filters in order to search for conversations. {% admonition type="warning" name="Optimizing search queries" %} Search queries can be complex, so optimizing them can help the performance of your search. Use the AND and OR operators to combine multiple filters to get the exact results you need and utilize pagination to limit the number of results returned. The default is 20 results per page and maximum is 150. See the pagination section for more details on how to use the starting_after param. {% /admonition %}

Nesting & Limitations

You can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4). There are some limitations to the amount of multiple's there can be:

  • There's a limit of max 2 nested filters
  • There's a limit of max 15 filters for each AND or OR group

Accepted Fields

Most keys listed as part of the The conversation model is searchable, whether writeable or not. The value you search for has to match the accepted type, otherwise the query will fail (ie. as created_at accepts a date, the value cannot be a string such as "foorbar"). The source.body field is unique as the search will not be performed against the entire value, but instead against every element of the value separately. For example, when searching for a conversation with a "I need support" body - the query should contain a = operator with the value "support" for such conversation to be returned. A query with a = operator and a "need support" value will not yield a result.

Field Type
id String
created_at Date (UNIX timestamp)
updated_at Date (UNIX timestamp)
source.type String
Accepted fields are conversation, email, facebook, instagram, phone_call, phone_switch, push, sms, twitter and whatsapp.
source.id String
source.delivered_as String
source.subject String
source.body String
source.author.id String
source.author.type String
source.author.name String
source.author.email String
source.url String
contact_ids String
teammate_ids String
admin_assignee_id String
team_assignee_id String
channel_initiated String
open Boolean
read Boolean
state String
waiting_since Date (UNIX timestamp)
snoozed_until Date (UNIX timestamp)
tag_ids String
priority String
statistics.time_to_assignment Integer
statistics.time_to_admin_reply Integer
statistics.time_to_first_close Integer
statistics.time_to_last_close Integer
statistics.median_time_to_reply Integer
statistics.first_contact_reply_at Date (UNIX timestamp)
statistics.first_assignment_at Date (UNIX timestamp)
statistics.first_admin_reply_at Date (UNIX timestamp)
statistics.first_close_at Date (UNIX timestamp)
statistics.last_assignment_at Date (UNIX timestamp)
statistics.last_assignment_admin_reply_at Date (UNIX timestamp)
statistics.last_contact_reply_at Date (UNIX timestamp)
statistics.last_admin_reply_at Date (UNIX timestamp)
statistics.last_close_at Date (UNIX timestamp)
statistics.last_closed_by_id String
statistics.count_reopens Integer
statistics.count_assignments Integer
statistics.count_conversation_parts Integer
conversation_rating.requested_at Date (UNIX timestamp)
conversation_rating.replied_at Date (UNIX timestamp)
conversation_rating.score Integer
conversation_rating.remark String
conversation_rating.contact_id String
conversation_rating.admin_d String
ai_agent_participated Boolean
ai_agent.resolution_state String
ai_agent.last_answer_type String
ai_agent.rating Integer
ai_agent.rating_remark String
ai_agent.source_type String
ai_agent.source_title String

Accepted Operators

The table below shows the operators you can use to define how you want to search for the value. The operator should be put in as a string ("="). The operator has to be compatible with the field's type (eg. you cannot search with > for a given string value as it's only compatible for integer's and dates).

Operator Valid Types Description
= All Equals
!= All Doesn't Equal
IN All In Shortcut for OR queries Values most be in Array
NIN All Not In Shortcut for OR ! queries Values must be in Array
> Integer Date (UNIX Timestamp) Greater (or equal) than
< Integer Date (UNIX Timestamp) Lower (or equal) than
~ String Contains
!~ String Doesn't Contain
^ String Starts With
$ String Ends With

πŸ”Œ Usage

const response = await client.conversations.search({
    query: {
        operator: "AND",
        value: [
            {
                field: "created_at",
                operator: ">",
                value: "1306054154",
            },
        ],
    },
    pagination: {
        per_page: 5,
    },
});
for await (const item of response) {
    console.log(item);
}

// Or you can manually iterate page-by-page
const page = await client.conversations.search({
    query: {
        operator: "AND",
        value: [
            {
                field: "created_at",
                operator: ">",
                value: "1306054154",
            },
        ],
    },
    pagination: {
        per_page: 5,
    },
});
while (page.hasNextPage()) {
    page = page.getNextPage();
}

βš™οΈ Parameters

request: Intercom.SearchRequest

requestOptions: Conversations.RequestOptions

client.conversations.reply({ ...params }) -> Intercom.Conversation

πŸ“ Description

You can reply to a conversation with a message from an admin or on behalf of a contact, or with a note for admins.

πŸ”Œ Usage

await client.conversations.reply({
    conversation_id: '123 or "last"',
    body: {
        message_type: "comment",
        type: "user",
        body: "Thanks again :)",
        intercom_user_id: "667d60f18a68186f43bafdf4",
    },
});

βš™οΈ Parameters

request: Intercom.ReplyToConversationRequest

requestOptions: Conversations.RequestOptions

client.conversations.manage({ ...params }) -> Intercom.Conversation

πŸ“ Description

For managing conversations you can:

  • Close a conversation
  • Snooze a conversation to reopen on a future date
  • Open a conversation which is snoozed or closed
  • Assign a conversation to an admin and/or team.

πŸ”Œ Usage

await client.conversations.manage({
    conversation_id: "123",
    body: {
        message_type: "assignment",
        type: "admin",
        admin_id: "12345",
        assignee_id: "4324241",
        body: "Goodbye :)",
    },
});

βš™οΈ Parameters

request: Intercom.ManageConversationPartsRequest

requestOptions: Conversations.RequestOptions

client.conversations.runAssignmentRules({ ...params }) -> Intercom.Conversation

πŸ“ Description

You can let a conversation be automatically assigned following assignment rules. {% admonition type="attention" name="When using workflows" %} It is not possible to use this endpoint with Workflows. {% /admonition %}

πŸ”Œ Usage

await client.conversations.runAssignmentRules({
    conversation_id: "123",
});

βš™οΈ Parameters

request: Intercom.AutoAssignConversationRequest

requestOptions: Conversations.RequestOptions

client.conversations.attachContactAsAdmin({ ...params }) -> Intercom.Conversation

πŸ“ Description

You can add participants who are contacts to a conversation, on behalf of either another contact or an admin.

{% admonition type="attention" name="Contacts without an email" %} If you add a contact via the email parameter and there is no user/lead found on that workspace with he given email, then we will create a new contact with role set to lead. {% /admonition %}

πŸ”Œ Usage

await client.conversations.attachContactAsAdmin({
    conversation_id: "123",
    admin_id: "12345",
    customer: {
        intercom_user_id: "667d61168a68186f43bafe0d",
    },
});

βš™οΈ Parameters

request: Intercom.AttachContactToConversationRequest

requestOptions: Conversations.RequestOptions

client.conversations.detachContactAsAdmin({ ...params }) -> Intercom.Conversation

πŸ“ Description

You can add participants who are contacts to a conversation, on behalf of either another contact or an admin.

{% admonition type="attention" name="Contacts without an email" %} If you add a contact via the email parameter and there is no user/lead found on that workspace with he given email, then we will create a new contact with role set to lead. {% /admonition %}

πŸ”Œ Usage

await client.conversations.detachContactAsAdmin({
    conversation_id: "123",
    contact_id: "123",
    admin_id: "5017690",
});

βš™οΈ Parameters

request: Intercom.DetachContactFromConversationRequest

requestOptions: Conversations.RequestOptions

client.conversations.redactConversationPart({ ...params }) -> Intercom.Conversation

πŸ“ Description

You can redact a conversation part or the source message of a conversation (as seen in the source object).

{% admonition type="info" name="Redacting parts and messages" %} If you are redacting a conversation part, it must have a body. If you are redacting a source message, it must have been created by a contact. We will return a conversation_part_not_redactable error if these criteria are not met. {% /admonition %}

πŸ”Œ Usage

await client.conversations.redactConversationPart({
    type: "conversation_part",
    conversation_id: "19894788788",
    conversation_part_id: "19381789428",
});

βš™οΈ Parameters

request: Intercom.RedactConversationRequest

requestOptions: Conversations.RequestOptions

client.conversations.convertToTicket({ ...params }) -> Intercom.Ticket

πŸ“ Description

You can convert a conversation to a ticket.

πŸ”Œ Usage

await client.conversations.convertToTicket({
    conversation_id: "123",
    ticket_type_id: "79",
});

βš™οΈ Parameters

request: Intercom.ConvertConversationToTicketRequest

requestOptions: Conversations.RequestOptions

Data Attributes

client.dataAttributes.list({ ...params }) -> Intercom.DataAttributeList

πŸ“ Description

You can fetch a list of all data attributes belonging to a workspace for contacts, companies or conversations.

πŸ”Œ Usage

await client.dataAttributes.list();

βš™οΈ Parameters

request: Intercom.ListDataAttributesRequest

requestOptions: DataAttributes.RequestOptions

client.dataAttributes.create({ ...params }) -> Intercom.DataAttribute

πŸ“ Description

You can create a data attributes for a contact or a company.

πŸ”Œ Usage

await client.dataAttributes.create({
    name: "Mithril Shirt",
    model: "company",
    data_type: "string",
});

βš™οΈ Parameters

request: Intercom.CreateDataAttributeRequest

requestOptions: DataAttributes.RequestOptions

client.dataAttributes.update({ ...params }) -> Intercom.DataAttribute

πŸ“ Description

You can update a data attribute.

🚧 Updating the data type is not possible

It is currently a dangerous action to execute changing a data attribute's type via the API. You will need to update the type via the UI instead.

πŸ”Œ Usage

await client.dataAttributes.update({
    data_attribute_id: "1",
    archived: false,
    description: "Just a plain old ring",
    options: [
        {
            value: "1-10",
        },
        {
            value: "11-20",
        },
    ],
});

βš™οΈ Parameters

request: Intercom.UpdateDataAttributeRequest

requestOptions: DataAttributes.RequestOptions

Events

client.events.list({ ...params }) -> Intercom.DataEventSummary

πŸ“ Description

🚧

Please note that you can only 'list' events that are less than 90 days old. Event counts and summaries will still include your events older than 90 days but you cannot 'list' these events individually if they are older than 90 days

The events belonging to a customer can be listed by sending a GET request to https://api.intercom.io/events with a user or lead identifier along with a type parameter. The identifier parameter can be one of user_id, email or intercom_user_id. The type parameter value must be user.

  • https://api.intercom.io/events?type=user&user_id={user_id}
  • https://api.intercom.io/events?type=user&email={email}
  • https://api.intercom.io/events?type=user&intercom_user_id={id} (this call can be used to list leads)

The email parameter value should be url encoded when sending.

You can optionally define the result page size as well with the per_page parameter.

πŸ”Œ Usage

await client.events.list({
    type: "type",
});

βš™οΈ Parameters

request: Intercom.ListEventsRequest

requestOptions: Events.RequestOptions

client.events.create({ ...params }) -> void

πŸ“ Description

You will need an Access Token that has write permissions to send Events. Once you have a key you can submit events via POST to the Events resource, which is located at https://api.intercom.io/events, or you can send events using one of the client libraries. When working with the HTTP API directly a client should send the event with a Content-Type of application/json.

When using the JavaScript API, adding the code to your app makes the Events API available. Once added, you can submit an event using the trackEvent method. This will associate the event with the Lead or currently logged-in user or logged-out visitor/lead and send it to Intercom. The final parameter is a map that can be used to send optional metadata about the event.

With the Ruby client you pass a hash describing the event to Intercom::Event.create, or call the track_user method directly on the current user object (e.g. user.track_event).

NB: For the JSON object types, please note that we do not currently support nested JSON structure.

Type Description Example
String The value is a JSON String "source":"desktop"
Number The value is a JSON Number "load": 3.67
Date The key ends with the String _date and the value is a Unix timestamp, assumed to be in the UTC timezone. "contact_date": 1392036272
Link The value is a HTTP or HTTPS URI. "article": "https://example.org/ab1de.html"
Rich Link The value is a JSON object that contains url and value keys. "article": {"url": "https://example.org/ab1de.html", "value":"the dude abides"}
Monetary Amount The value is a JSON object that contains amount and currency keys. The amount key is a positive integer representing the amount in cents. The price in the example to the right denotes €349.99. "price": {"amount": 34999, "currency": "eur"}

Lead Events

When submitting events for Leads, you will need to specify the Lead's id.

Metadata behaviour

  • We currently limit the number of tracked metadata keys to 10 per event. Once the quota is reached, we ignore any further keys we receive. The first 10 metadata keys are determined by the order in which they are sent in with the event.
  • It is not possible to change the metadata keys once the event has been sent. A new event will need to be created with the new keys and you can archive the old one.
  • There might be up to 24 hrs delay when you send a new metadata for an existing event.

Event de-duplication

The API may detect and ignore duplicate events. Each event is uniquely identified as a combination of the following data - the Workspace identifier, the Contact external identifier, the Data Event name and the Data Event created time. As a result, it is strongly recommended to send a second granularity Unix timestamp in the created_at field.

Duplicated events are responded to using the normal 202 Accepted code - an error is not thrown, however repeat requests will be counted against any rate limit that is in place.

HTTP API Responses

  • Successful responses to submitted events return 202 Accepted with an empty body.
  • Unauthorised access will be rejected with a 401 Unauthorized or 403 Forbidden response code.
  • Events sent about users that cannot be found will return a 404 Not Found.
  • Event lists containing duplicate events will have those duplicates ignored.
  • Server errors will return a 500 response code and may contain an error message in the body.

πŸ”Œ Usage

await client.events.create({
    id: "8a88a590-e1c3-41e2-a502-e0649dbf721c",
    event_name: "invited-friend",
    created_at: 1671028894,
});

βš™οΈ Parameters

request: Intercom.CreateDataEventRequest

requestOptions: Events.RequestOptions

client.events.summaries({ ...params }) -> void

πŸ“ Description

Create event summaries for a user. Event summaries are used to track the number of times an event has occurred, the first time it occurred and the last time it occurred.

πŸ”Œ Usage

await client.events.summaries();

βš™οΈ Parameters

request: Intercom.ListEventSummariesRequest

requestOptions: Events.RequestOptions

Data Export

client.dataExport.create({ ...params }) -> Intercom.DataExport

πŸ“ Description

To create your export job, you need to send a POST request to the export endpoint https://api.intercom.io/export/content/data.

The only parameters you need to provide are the range of dates that you want exported.

🚧 Limit of one active job

You can only have one active job per workspace. You will receive a HTTP status code of 429 with the message Exceeded rate limit of 1 pending message data export jobs if you attempt to create a second concurrent job.

❗️ Updated_at not included

It should be noted that the timeframe only includes messages sent during the time period and not messages that were only updated during this period. For example, if a message was updated yesterday but sent two days ago, you would need to set the created_at_after date before the message was sent to include that in your retrieval job.

πŸ“˜ Date ranges are inclusive

Requesting data for 2018-06-01 until 2018-06-30 will get all data for those days including those specified - e.g. 2018-06-01 00:00:00 until 2018-06-30 23:59:99.

πŸ”Œ Usage

await client.dataExport.create({
    created_at_after: 1719474967,
    created_at_before: 1719492967,
});

βš™οΈ Parameters

request: Intercom.CreateDataExportRequest

requestOptions: DataExport.RequestOptions

client.dataExport.find({ ...params }) -> Intercom.DataExport

πŸ“ Description

You can view the status of your job by sending a GET request to the URL https://api.intercom.io/export/content/data/{job_identifier} - the {job_identifier} is the value returned in the response when you first created the export job. More on it can be seen in the Export Job Model.

🚧 Jobs expire after two days All jobs that have completed processing (and are thus available to download from the provided URL) will have an expiry limit of two days from when the export ob completed. After this, the data will no longer be available.

πŸ”Œ Usage

await client.dataExport.find({
    job_identifier: "job_identifier",
});

βš™οΈ Parameters

request: Intercom.FindDataExportRequest

requestOptions: DataExport.RequestOptions

client.dataExport.cancel({ ...params }) -> Intercom.DataExport

πŸ“ Description

You can cancel your job

πŸ”Œ Usage

await client.dataExport.cancel({
    job_identifier: "job_identifier",
});

βš™οΈ Parameters

request: Intercom.CancelDataExportRequest

requestOptions: DataExport.RequestOptions

client.dataExport.download({ ...params }) -> void

πŸ“ Description

When a job has a status of complete, and thus a filled download_url, you can download your data by hitting that provided URL, formatted like so: https://api.intercom.io/download/content/data/xyz1234.

Your exported message data will be streamed continuously back down to you in a gzipped CSV format.

πŸ“˜ Octet header required

You will have to specify the header Accept: application/octet-stream when hitting this endpoint.

πŸ”Œ Usage

await client.dataExport.download({
    job_identifier: "job_identifier",
});

βš™οΈ Parameters

request: Intercom.DownloadDataExportRequest

requestOptions: DataExport.RequestOptions

Messages

client.messages.create({ ...params }) -> Intercom.Message

πŸ“ Description

You can create a message that has been initiated by an admin. The conversation can be either an in-app message or an email.

🚧 Sending for visitors

There can be a short delay between when a contact is created and when a contact becomes available to be messaged through the API. A 404 Not Found error will be returned in this case.

This will return the Message model that has been created.

🚧 Retrieving Associated Conversations

As this is a message, there will be no conversation present until the contact responds. Once they do, you will have to search for a contact's conversations with the id of the message.

πŸ”Œ Usage

await client.messages.create({
    message_type: "inapp",
    subject: "Thanks for everything",
    body: "heyy",
    template: "plain",
    from: {
        type: "admin",
        id: 394051,
    },
    to: {
        type: "user",
        id: "536e564f316c83104c000020",
    },
    created_at: 1590000000,
    create_conversation_without_contact_reply: true,
});

βš™οΈ Parameters

request: Intercom.CreateMessageRequest

requestOptions: Messages.RequestOptions

Segments

client.segments.list({ ...params }) -> Intercom.SegmentList

πŸ“ Description

You can fetch a list of all segments.

πŸ”Œ Usage

await client.segments.list();

βš™οΈ Parameters

request: Intercom.ListSegmentsRequest

requestOptions: Segments.RequestOptions

client.segments.find({ ...params }) -> Intercom.Segment

πŸ“ Description

You can fetch the details of a single segment.

πŸ”Œ Usage

await client.segments.find({
    segment_id: "123",
});

βš™οΈ Parameters

request: Intercom.FindSegmentRequest

requestOptions: Segments.RequestOptions

Subscription Types

client.subscriptionTypes.list() -> Intercom.SubscriptionTypeList

πŸ“ Description

You can list all subscription types. A list of subscription type objects will be returned.

πŸ”Œ Usage

await client.subscriptionTypes.list();

βš™οΈ Parameters

requestOptions: SubscriptionTypes.RequestOptions

PhoneCallRedirects

client.phoneCallRedirects.create({ ...params }) -> Intercom.PhoneSwitch

πŸ“ Description

You can use the API to deflect phone calls to the Intercom Messenger. Calling this endpoint will send an SMS with a link to the Messenger to the phone number specified.

If custom attributes are specified, they will be added to the user or lead's custom data attributes.

πŸ”Œ Usage

await client.phoneCallRedirects.create({
    phone: "+353832345678",
    custom_attributes: {
        issue_type: "Billing",
        priority: "High",
    },
});

βš™οΈ Parameters

request: Intercom.CreatePhoneCallRedirectRequest

requestOptions: PhoneCallRedirects.RequestOptions

Teams

client.teams.list() -> Intercom.TeamList

πŸ“ Description

This will return a list of team objects for the App.

πŸ”Œ Usage

await client.teams.list();

βš™οΈ Parameters

requestOptions: Teams.RequestOptions

client.teams.find({ ...params }) -> Intercom.Team

πŸ“ Description

You can fetch the details of a single team, containing an array of admins that belong to this team.

πŸ”Œ Usage

await client.teams.find({
    team_id: "123",
});

βš™οΈ Parameters

request: Intercom.FindTeamRequest

requestOptions: Teams.RequestOptions

Ticket Types

client.ticketTypes.list() -> Intercom.TicketTypeList

πŸ“ Description

You can get a list of all ticket types for a workspace.

πŸ”Œ Usage

await client.ticketTypes.list();

βš™οΈ Parameters

requestOptions: TicketTypes.RequestOptions

client.ticketTypes.create({ ...params }) -> Intercom.TicketType

πŸ“ Description

You can create a new ticket type.

πŸ“˜ Creating ticket types.

Every ticket type will be created with two default attributes: default_title and default_description. For the icon propery, use an emoji from Twemoji Cheatsheet

πŸ”Œ Usage

await client.ticketTypes.create({
    name: "Customer Issue",
    description: "Customer Report Template",
    category: "Customer",
    icon: "\uD83C\uDF9F\uFE0F",
});

βš™οΈ Parameters

request: Intercom.CreateTicketTypeRequest

requestOptions: TicketTypes.RequestOptions

client.ticketTypes.get({ ...params }) -> Intercom.TicketType

πŸ“ Description

You can fetch the details of a single ticket type.

πŸ”Œ Usage

await client.ticketTypes.get({
    ticket_type_id: "ticket_type_id",
});

βš™οΈ Parameters

request: Intercom.FindTicketTypeRequest

requestOptions: TicketTypes.RequestOptions

client.ticketTypes.update({ ...params }) -> Intercom.TicketType

πŸ“ Description

You can update a ticket type.

πŸ“˜ Updating a ticket type.

For the icon propery, use an emoji from Twemoji Cheatsheet

πŸ”Œ Usage

await client.ticketTypes.update({
    ticket_type_id: "ticket_type_id",
    name: "Bug Report 2",
});

βš™οΈ Parameters

request: Intercom.UpdateTicketTypeRequest

requestOptions: TicketTypes.RequestOptions

Tickets

client.tickets.reply({ ...params }) -> Intercom.TicketReply

πŸ“ Description

You can reply to a ticket with a message from an admin or on behalf of a contact, or with a note for admins.

πŸ”Œ Usage

await client.tickets.reply({
    ticket_id: "123",
    body: {
        message_type: "comment",
        type: "user",
        body: "Thanks again :)",
        intercom_user_id: "667d619d8a68186f43bafe82",
    },
});

βš™οΈ Parameters

request: Intercom.ReplyToTicketRequest

requestOptions: Tickets.RequestOptions

client.tickets.create({ ...params }) -> Intercom.Ticket

πŸ“ Description

You can create a new ticket.

πŸ”Œ Usage

await client.tickets.create({
    ticket_type_id: "1234",
    contacts: [
        {
            id: "667d61b78a68186f43bafe8d",
        },
    ],
    ticket_attributes: {
        _default_title_: "example",
        _default_description_: "there is a problem",
    },
});

βš™οΈ Parameters

request: Intercom.CreateTicketRequest

requestOptions: Tickets.RequestOptions

client.tickets.get({ ...params }) -> Intercom.Ticket

πŸ“ Description

You can fetch the details of a single ticket.

πŸ”Œ Usage

await client.tickets.get({
    ticket_id: "ticket_id",
});

βš™οΈ Parameters

request: Intercom.FindTicketRequest

requestOptions: Tickets.RequestOptions

client.tickets.update({ ...params }) -> Intercom.Ticket

πŸ“ Description

You can update a ticket.

πŸ”Œ Usage

await client.tickets.update({
    ticket_id: "ticket_id",
    ticket_attributes: {
        _default_title_: "example",
        _default_description_: "there is a problem",
    },
    state: "in_progress",
    open: true,
    snoozed_until: 1673609604,
    assignment: {
        admin_id: "991267883",
        assignee_id: "991267885",
    },
});

βš™οΈ Parameters

request: Intercom.UpdateTicketRequest

requestOptions: Tickets.RequestOptions

client.tickets.search({ ...params }) -> core.Page

πŸ“ Description

You can search for multiple tickets by the value of their attributes in order to fetch exactly which ones you want.

To search for tickets, you send a POST request to https://api.intercom.io/tickets/search.

This will accept a query object in the body which will define your filters. {% admonition type="warning" name="Optimizing search queries" %} Search queries can be complex, so optimizing them can help the performance of your search. Use the AND and OR operators to combine multiple filters to get the exact results you need and utilize pagination to limit the number of results returned. The default is 20 results per page. See the pagination section for more details on how to use the starting_after param. {% /admonition %}

Nesting & Limitations

You can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4). There are some limitations to the amount of multiples there can be:

  • There's a limit of max 2 nested filters
  • There's a limit of max 15 filters for each AND or OR group

Accepted Fields

Most keys listed as part of the Ticket model are searchable, whether writeable or not. The value you search for has to match the accepted type, otherwise the query will fail (ie. as created_at accepts a date, the value cannot be a string such as "foobar").

Field Type
id String
created_at Date (UNIX timestamp)
updated_at Date (UNIX timestamp)
default_title String
default_description String
category String
ticket_type_id String
contact_ids String
teammate_ids String
admin_assignee_id String
team_assignee_id String
open Boolean
state String
snoozed_until Date (UNIX timestamp)
ticket_attribute.{id} String or Boolean or Date (UNIX timestamp) or Float or Integer

Accepted Operators

{% admonition type="info" name="Searching based on created_at" %} You may use the <= or >= operators to search by created_at. {% /admonition %}

The table below shows the operators you can use to define how you want to search for the value. The operator should be put in as a string ("="). The operator has to be compatible with the field's type (eg. you cannot search with > for a given string value as it's only compatible for integer's and dates).

Operator Valid Types Description
= All Equals
!= All Doesn't Equal
IN All In Shortcut for OR queries Values most be in Array
NIN All Not In Shortcut for OR ! queries Values must be in Array
> Integer Date (UNIX Timestamp) Greater (or equal) than
< Integer Date (UNIX Timestamp) Lower (or equal) than
~ String Contains
!~ String Doesn't Contain
^ String Starts With
$ String Ends With

πŸ”Œ Usage

const response = await client.tickets.search({
    query: {
        operator: "AND",
        value: [
            {
                field: "created_at",
                operator: ">",
                value: "1306054154",
            },
        ],
    },
    pagination: {
        per_page: 5,
    },
});
for await (const item of response) {
    console.log(item);
}

// Or you can manually iterate page-by-page
const page = await client.tickets.search({
    query: {
        operator: "AND",
        value: [
            {
                field: "created_at",
                operator: ">",
                value: "1306054154",
            },
        ],
    },
    pagination: {
        per_page: 5,
    },
});
while (page.hasNextPage()) {
    page = page.getNextPage();
}

βš™οΈ Parameters

request: Intercom.SearchRequest

requestOptions: Tickets.RequestOptions

Visitors

client.visitors.find({ ...params }) -> Intercom.Visitor

πŸ“ Description

You can fetch the details of a single visitor.

πŸ”Œ Usage

await client.visitors.find({
    user_id: "user_id",
});

βš™οΈ Parameters

request: Intercom.FindVisitorRequest

requestOptions: Visitors.RequestOptions

client.visitors.update({ ...params }) -> Intercom.Visitor

πŸ“ Description

Sending a PUT request to /visitors will result in an update of an existing Visitor.

Option 1. You can update a visitor by passing in the user_id of the visitor in the Request body.

Option 2. You can update a visitor by passing in the id of the visitor in the Request body.

πŸ”Œ Usage

await client.visitors.update({
    id: "667d61cc8a68186f43bafe95",
    name: "Gareth Bale",
});

βš™οΈ Parameters

request: Intercom.UpdateVisitorRequest

requestOptions: Visitors.RequestOptions

client.visitors.mergeToContact({ ...params }) -> Intercom.Contact

πŸ“ Description

You can merge a Visitor to a Contact of role type lead or user.

πŸ“˜ What happens upon a visitor being converted?

If the User exists, then the Visitor will be merged into it, the Visitor deleted and the User returned. If the User does not exist, the Visitor will be converted to a User, with the User identifiers replacing it's Visitor identifiers.

πŸ”Œ Usage

await client.visitors.mergeToContact({
    type: "user",
    user: {
        id: "8a88a590-e1c3-41e2-a502-e0649dbf721c",
        email: "foo@bar.com",
    },
    visitor: {
        user_id: "3ecf64d0-9ed1-4e9f-88e1-da7d6e6782f3",
    },
});

βš™οΈ Parameters

request: Intercom.MergeVisitorToContactRequest

requestOptions: Visitors.RequestOptions

HelpCenters Collections

client.helpCenters.collections.list({ ...params }) -> core.Page

πŸ“ Description

You can fetch a list of all collections by making a GET request to https://api.intercom.io/help_center/collections.

Collections will be returned in descending order on the updated_at attribute. This means if you need to iterate through results then we'll show the most recently updated collections first.

πŸ”Œ Usage

const response = await client.helpCenters.collections.list();
for await (const item of response) {
    console.log(item);
}

// Or you can manually iterate page-by-page
const page = await client.helpCenters.collections.list();
while (page.hasNextPage()) {
    page = page.getNextPage();
}

βš™οΈ Parameters

request: Intercom.helpCenters.ListCollectionsRequest

requestOptions: Collections.RequestOptions

client.helpCenters.collections.create({ ...params }) -> Intercom.Collection

πŸ“ Description

You can create a new collection by making a POST request to https://api.intercom.io/help_center/collections.

πŸ”Œ Usage

await client.helpCenters.collections.create({
    name: "Thanks for everything",
});

βš™οΈ Parameters

request: Intercom.helpCenters.CreateCollectionRequest

requestOptions: Collections.RequestOptions

client.helpCenters.collections.find({ ...params }) -> Intercom.Collection

πŸ“ Description

You can fetch the details of a single collection by making a GET request to https://api.intercom.io/help_center/collections/<id>.

πŸ”Œ Usage

await client.helpCenters.collections.find({
    collection_id: "123",
});

βš™οΈ Parameters

request: Intercom.helpCenters.FindCollectionRequest

requestOptions: Collections.RequestOptions

client.helpCenters.collections.update({ ...params }) -> Intercom.Collection

πŸ“ Description

You can update the details of a single collection by making a PUT request to https://api.intercom.io/collections/<id>.

πŸ”Œ Usage

await client.helpCenters.collections.update({
    collection_id: "123",
    name: "Update collection name",
});

βš™οΈ Parameters

request: Intercom.helpCenters.UpdateCollectionRequest

requestOptions: Collections.RequestOptions

client.helpCenters.collections.delete({ ...params }) -> Intercom.DeletedCollectionObject

πŸ“ Description

You can delete a single collection by making a DELETE request to https://api.intercom.io/collections/<id>.

πŸ”Œ Usage

await client.helpCenters.collections.delete({
    collection_id: "123",
});

βš™οΈ Parameters

request: Intercom.helpCenters.DeleteCollectionRequest

requestOptions: Collections.RequestOptions

News Items

client.news.items.list() -> Intercom.PaginatedNewsItemResponse

πŸ“ Description

You can fetch a list of all news items

πŸ”Œ Usage

await client.news.items.list();

βš™οΈ Parameters

requestOptions: Items.RequestOptions

client.news.items.create({ ...params }) -> Intercom.NewsItem

πŸ“ Description

You can create a news item

πŸ”Œ Usage

await client.news.items.create({
    title: "Halloween is here!",
    body: "<p>New costumes in store for this spooky season</p>",
    sender_id: 991267734,
    state: "live",
    deliver_silently: true,
    labels: ["Product", "Update", "New"],
    reactions: ["\uD83D\uDE06", "\uD83D\uDE05"],
    newsfeed_assignments: [
        {
            newsfeed_id: 53,
            published_at: 1664638214,
        },
    ],
});

βš™οΈ Parameters

request: Intercom.NewsItemRequest

requestOptions: Items.RequestOptions

client.news.items.find({ ...params }) -> Intercom.NewsItem

πŸ“ Description

You can fetch the details of a single news item.

πŸ”Œ Usage

await client.news.items.find({
    news_item_id: "123",
});

βš™οΈ Parameters

request: Intercom.news.FindNewsItemRequest

requestOptions: Items.RequestOptions

client.news.items.update({ ...params }) -> Intercom.NewsItem

πŸ”Œ Usage

await client.news.items.update({
    news_item_id: "123",
    body: {
        title: "Christmas is here!",
        body: "<p>New gifts in store for the jolly season</p>",
        sender_id: 991267745,
        reactions: ["\uD83D\uDE1D", "\uD83D\uDE02"],
    },
});

βš™οΈ Parameters

request: Intercom.news.UpdateNewsItemRequest

requestOptions: Items.RequestOptions

client.news.items.delete({ ...params }) -> Intercom.DeletedObject

πŸ“ Description

You can delete a single news item.

πŸ”Œ Usage

await client.news.items.delete({
    news_item_id: "123",
});

βš™οΈ Parameters

request: Intercom.news.DeleteNewsItemRequest

requestOptions: Items.RequestOptions

News Feeds

client.news.feeds.listItems({ ...params }) -> Intercom.PaginatedNewsItemResponse

πŸ“ Description

You can fetch a list of all news items that are live on a given newsfeed

πŸ”Œ Usage

await client.news.feeds.listItems({
    newsfeed_id: "123",
});

βš™οΈ Parameters

request: Intercom.news.ListNewsFeedItemsRequest

requestOptions: Feeds.RequestOptions

client.news.feeds.list() -> Intercom.PaginatedNewsfeedResponse

πŸ“ Description

You can fetch a list of all newsfeeds

πŸ”Œ Usage

await client.news.feeds.list();

βš™οΈ Parameters

requestOptions: Feeds.RequestOptions

client.news.feeds.find({ ...params }) -> Intercom.Newsfeed

πŸ“ Description

You can fetch the details of a single newsfeed

πŸ”Œ Usage

await client.news.feeds.find({
    newsfeed_id: "123",
});

βš™οΈ Parameters

request: Intercom.news.FindNewsFeedRequest

requestOptions: Feeds.RequestOptions

TicketTypes Attributes

client.ticketTypes.attributes.create({ ...params }) -> Intercom.TicketTypeAttribute

πŸ“ Description

You can create a new attribute for a ticket type.

πŸ”Œ Usage

await client.ticketTypes.attributes.create({
    ticket_type_id: "ticket_type_id",
    name: "Attribute Title",
    description: "Attribute Description",
    data_type: "string",
    required_to_create: false,
});

βš™οΈ Parameters

request: Intercom.ticketTypes.CreateTicketTypeAttributeRequest

requestOptions: Attributes.RequestOptions

client.ticketTypes.attributes.update({ ...params }) -> Intercom.TicketTypeAttribute

πŸ“ Description

You can update an existing attribute for a ticket type.

πŸ”Œ Usage

await client.ticketTypes.attributes.update({
    ticket_type_id: "ticket_type_id",
    attribute_id: "attribute_id",
    description: "New Attribute Description",
});

βš™οΈ Parameters

request: Intercom.ticketTypes.UpdateTicketTypeAttributeRequest

requestOptions: Attributes.RequestOptions