Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 24 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
# Intercom TypeScript Library (intercom-client)
# Intercom TypeScript Library

[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fintercom%2Fintercom-node)
[![npm shield](https://img.shields.io/npm/v/intercom-client)](https://www.npmjs.com/package/intercom-client)

The Intercom TypeScript library provides convenient access to the Intercom API from TypeScript.

[![npm](https://img.shields.io/npm/v/intercom-client)](https://www.npmjs.com/package/intercom-client)
![Intercom API Version](https://img.shields.io/badge/Intercom%20API%20Version-2.11-blue)
![Typescript Supported](https://img.shields.io/badge/Typescript-Supported-lightgrey)

## Project Updates

The TypeScript SDK has been updated to support latest API version (2.11).
Expand All @@ -32,9 +28,9 @@ import { IntercomClient } from "intercom-client";

const client = new IntercomClient({ token: "YOUR_TOKEN" });
await client.articles.create({
title: "How to create an account",
description: "Example article about creating an account.",
body: "Here are the steps to create an account.",
title: "Thanks for everything",
description: "Description of the Article",
body: "Body of the Article",
author_id: 1295,
state: "published",
});
Expand Down Expand Up @@ -72,6 +68,26 @@ try {
}
```

## Pagination

List endpoints are paginated. The SDK provides an iterator so that you can simply loop over the items:

```typescript
import { IntercomClient } from "intercom-client";

const client = new IntercomClient({ token: "YOUR_TOKEN" });
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();
}
```

## Request Options

This client library also supports passing in [`request` options](https://github.com/axios/axios#request-config):
Expand All @@ -94,26 +110,6 @@ client.useRequestOpts({
});
```

## Pagination

List endpoints are paginated. The SDK provides an iterator so that you can simply loop over the items:

```typescript
import { IntercomClient } from "intercom-client";

const client = new IntercomClient({ token: "YOUR_TOKEN" });
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();
}
```

## Advanced

### Additional Headers
Expand Down
12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "intercom-client",
"version": "6.0.0",
"version": "6.0.1",
"private": false,
"repository": "https://github.com/intercom/intercom-node",
"main": "./index.js",
Expand Down Expand Up @@ -39,5 +39,13 @@
"fs": false,
"os": false,
"path": false
}
},
"license": "Apache-2.0",
"description": "Official Node bindings to the Intercom API",
"homepage": "https://github.com/intercom/intercom-node",
"bugs": "https://github.com/intercom/intercom-node/issues",
"keywords": [
"intercom",
"api"
]
}
20 changes: 10 additions & 10 deletions src/api/resources/admins/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ export class Admins {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "intercom-client",
"X-Fern-SDK-Version": "6.0.0",
"User-Agent": "intercom-client/6.0.0",
"X-Fern-SDK-Version": "6.0.1",
"User-Agent": "intercom-client/6.0.1",
"Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
Expand Down Expand Up @@ -167,8 +167,8 @@ export class Admins {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "intercom-client",
"X-Fern-SDK-Version": "6.0.0",
"User-Agent": "intercom-client/6.0.0",
"X-Fern-SDK-Version": "6.0.1",
"User-Agent": "intercom-client/6.0.1",
"Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
Expand Down Expand Up @@ -249,8 +249,8 @@ export class Admins {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "intercom-client",
"X-Fern-SDK-Version": "6.0.0",
"User-Agent": "intercom-client/6.0.0",
"X-Fern-SDK-Version": "6.0.1",
"User-Agent": "intercom-client/6.0.1",
"Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
Expand Down Expand Up @@ -315,8 +315,8 @@ export class Admins {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "intercom-client",
"X-Fern-SDK-Version": "6.0.0",
"User-Agent": "intercom-client/6.0.0",
"X-Fern-SDK-Version": "6.0.1",
"User-Agent": "intercom-client/6.0.1",
"Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
Expand Down Expand Up @@ -388,8 +388,8 @@ export class Admins {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "intercom-client",
"X-Fern-SDK-Version": "6.0.0",
"User-Agent": "intercom-client/6.0.0",
"X-Fern-SDK-Version": "6.0.1",
"User-Agent": "intercom-client/6.0.1",
"Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
Expand Down
14 changes: 12 additions & 2 deletions src/api/resources/admins/types/Admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,17 @@ export interface Admin {
has_inbox_seat: boolean;
/** This object represents the avatar associated with the admin. */
team_ids: number[];
/** Image for the associated team or teammate */
avatar?: string;
/** The avatar object associated with the admin */
avatar?: Admin.Avatar;
team_priority_level?: Intercom.TeamPriorityLevel;
}

export namespace Admin {
/**
* The avatar object associated with the admin
*/
export interface Avatar {
/** URL of the admin's avatar image */
image_url: string;
}
}
24 changes: 12 additions & 12 deletions src/api/resources/articles/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ export class Articles {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "intercom-client",
"X-Fern-SDK-Version": "6.0.0",
"User-Agent": "intercom-client/6.0.0",
"X-Fern-SDK-Version": "6.0.1",
"User-Agent": "intercom-client/6.0.1",
"Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
Expand Down Expand Up @@ -219,8 +219,8 @@ export class Articles {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "intercom-client",
"X-Fern-SDK-Version": "6.0.0",
"User-Agent": "intercom-client/6.0.0",
"X-Fern-SDK-Version": "6.0.1",
"User-Agent": "intercom-client/6.0.1",
"Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
Expand Down Expand Up @@ -295,8 +295,8 @@ export class Articles {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "intercom-client",
"X-Fern-SDK-Version": "6.0.0",
"User-Agent": "intercom-client/6.0.0",
"X-Fern-SDK-Version": "6.0.1",
"User-Agent": "intercom-client/6.0.1",
"Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
Expand Down Expand Up @@ -372,8 +372,8 @@ export class Articles {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "intercom-client",
"X-Fern-SDK-Version": "6.0.0",
"User-Agent": "intercom-client/6.0.0",
"X-Fern-SDK-Version": "6.0.1",
"User-Agent": "intercom-client/6.0.1",
"Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
Expand Down Expand Up @@ -448,8 +448,8 @@ export class Articles {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "intercom-client",
"X-Fern-SDK-Version": "6.0.0",
"User-Agent": "intercom-client/6.0.0",
"X-Fern-SDK-Version": "6.0.1",
"User-Agent": "intercom-client/6.0.1",
"Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
Expand Down Expand Up @@ -540,8 +540,8 @@ export class Articles {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "intercom-client",
"X-Fern-SDK-Version": "6.0.0",
"User-Agent": "intercom-client/6.0.0",
"X-Fern-SDK-Version": "6.0.1",
"User-Agent": "intercom-client/6.0.1",
"Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
Expand Down
44 changes: 22 additions & 22 deletions src/api/resources/companies/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ export class Companies {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "intercom-client",
"X-Fern-SDK-Version": "6.0.0",
"User-Agent": "intercom-client/6.0.0",
"X-Fern-SDK-Version": "6.0.1",
"User-Agent": "intercom-client/6.0.1",
"Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
Expand Down Expand Up @@ -228,8 +228,8 @@ export class Companies {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "intercom-client",
"X-Fern-SDK-Version": "6.0.0",
"User-Agent": "intercom-client/6.0.0",
"X-Fern-SDK-Version": "6.0.1",
"User-Agent": "intercom-client/6.0.1",
"Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
Expand Down Expand Up @@ -304,8 +304,8 @@ export class Companies {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "intercom-client",
"X-Fern-SDK-Version": "6.0.0",
"User-Agent": "intercom-client/6.0.0",
"X-Fern-SDK-Version": "6.0.1",
"User-Agent": "intercom-client/6.0.1",
"Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
Expand Down Expand Up @@ -383,8 +383,8 @@ export class Companies {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "intercom-client",
"X-Fern-SDK-Version": "6.0.0",
"User-Agent": "intercom-client/6.0.0",
"X-Fern-SDK-Version": "6.0.1",
"User-Agent": "intercom-client/6.0.1",
"Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
Expand Down Expand Up @@ -458,8 +458,8 @@ export class Companies {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "intercom-client",
"X-Fern-SDK-Version": "6.0.0",
"User-Agent": "intercom-client/6.0.0",
"X-Fern-SDK-Version": "6.0.1",
"User-Agent": "intercom-client/6.0.1",
"Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
Expand Down Expand Up @@ -542,8 +542,8 @@ export class Companies {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "intercom-client",
"X-Fern-SDK-Version": "6.0.0",
"User-Agent": "intercom-client/6.0.0",
"X-Fern-SDK-Version": "6.0.1",
"User-Agent": "intercom-client/6.0.1",
"Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
Expand Down Expand Up @@ -620,8 +620,8 @@ export class Companies {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "intercom-client",
"X-Fern-SDK-Version": "6.0.0",
"User-Agent": "intercom-client/6.0.0",
"X-Fern-SDK-Version": "6.0.1",
"User-Agent": "intercom-client/6.0.1",
"Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
Expand Down Expand Up @@ -716,8 +716,8 @@ export class Companies {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "intercom-client",
"X-Fern-SDK-Version": "6.0.0",
"User-Agent": "intercom-client/6.0.0",
"X-Fern-SDK-Version": "6.0.1",
"User-Agent": "intercom-client/6.0.1",
"Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
Expand Down Expand Up @@ -816,8 +816,8 @@ export class Companies {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "intercom-client",
"X-Fern-SDK-Version": "6.0.0",
"User-Agent": "intercom-client/6.0.0",
"X-Fern-SDK-Version": "6.0.1",
"User-Agent": "intercom-client/6.0.1",
"Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
Expand Down Expand Up @@ -911,8 +911,8 @@ export class Companies {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "intercom-client",
"X-Fern-SDK-Version": "6.0.0",
"User-Agent": "intercom-client/6.0.0",
"X-Fern-SDK-Version": "6.0.1",
"User-Agent": "intercom-client/6.0.1",
"Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
Expand Down Expand Up @@ -992,8 +992,8 @@ export class Companies {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "intercom-client",
"X-Fern-SDK-Version": "6.0.0",
"User-Agent": "intercom-client/6.0.0",
"X-Fern-SDK-Version": "6.0.1",
"User-Agent": "intercom-client/6.0.1",
"Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
Expand Down
Loading
Loading