Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

🌿 Fern Regeneration -- March 13, 2025 #479

Merged
merged 1 commit into from
Mar 13, 2025
Merged
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.heygears.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.1.0",
"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"
]
}
26 changes: 12 additions & 14 deletions reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ Companies will be only visible in Intercom when there is at least one associated

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`" %}
{% admonition type="warning" 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 %}

Expand Down Expand Up @@ -1109,7 +1109,7 @@ await client.companies.find({

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

{% admonition type="attention" name="Using `company_id`" %}
{% admonition type="warning" 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 %}

Expand Down Expand Up @@ -2400,7 +2400,6 @@ Most key listed as part of the Contacts Model are searchable, whether writeable
| email | String |
| email_domain | String |
| phone | String |
| formatted_phone | String |
| external_id | String |
| created_at | Date (UNIX Timestamp) |
| signed_up_at | Date (UNIX Timestamp) |
Expand Down Expand Up @@ -2438,7 +2437,7 @@ Most key listed as part of the Contacts Model are searchable, whether writeable

### Accepted Operators

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

Expand Down Expand Up @@ -4300,11 +4299,9 @@ For managing conversations you can:
await client.conversations.manage({
conversation_id: "123",
body: {
message_type: "assignment",
message_type: "close",
type: "admin",
admin_id: "12345",
assignee_id: "4324241",
body: "Goodbye :)",
},
});
```
Expand Down Expand Up @@ -4353,8 +4350,11 @@ await client.conversations.manage({
<dl>
<dd>

{% admonition type="danger" name="Deprecation of Run Assignment Rules" %}
Run assignment rules is now deprecated in version 2.12 and future versions and will be permanently removed on December 31, 2026. After this date, any requests made to this endpoint will fail.
{% /admonition %}
You can let a conversation be automatically assigned following assignment rules.
{% admonition type="attention" name="When using workflows" %}
{% admonition type="warning" name="When using workflows" %}
It is not possible to use this endpoint with Workflows.
{% /admonition %}

Expand Down Expand Up @@ -4423,7 +4423,7 @@ await client.conversations.runAssignmentRules({

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" %}
{% admonition type="warning" 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 %}

Expand Down Expand Up @@ -4496,7 +4496,7 @@ await client.conversations.attachContactAsAdmin({

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" %}
{% admonition type="warning" 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 %}

Expand Down Expand Up @@ -5477,9 +5477,9 @@ This will return the Message model that has been created.

```typescript
await client.messages.create({
message_type: "inapp",
message_type: "email",
subject: "Thanks for everything",
body: "heyy",
body: "Hello there",
template: "plain",
from: {
type: "admin",
Expand All @@ -5489,8 +5489,6 @@ await client.messages.create({
type: "user",
id: "536e564f316c83104c000020",
},
created_at: 1590000000,
create_conversation_without_contact_reply: true,
});
```

Expand Down
30 changes: 15 additions & 15 deletions src/api/resources/admins/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,16 @@ 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.1.0",
"User-Agent": "intercom-client/6.1.0",
"Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...requestOptions?.headers,
},
contentType: "application/json",
requestType: "json",
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000,
maxRetries: requestOptions?.maxRetries,
abortSignal: requestOptions?.abortSignal,
});
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.1.0",
"User-Agent": "intercom-client/6.1.0",
"Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
Expand All @@ -177,7 +177,7 @@ export class Admins {
contentType: "application/json",
requestType: "json",
body: _body,
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000,
maxRetries: requestOptions?.maxRetries,
abortSignal: requestOptions?.abortSignal,
});
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.1.0",
"User-Agent": "intercom-client/6.1.0",
"Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
Expand All @@ -259,7 +259,7 @@ export class Admins {
contentType: "application/json",
queryParameters: _queryParams,
requestType: "json",
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000,
maxRetries: requestOptions?.maxRetries,
abortSignal: requestOptions?.abortSignal,
});
Expand Down Expand Up @@ -315,16 +315,16 @@ 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.1.0",
"User-Agent": "intercom-client/6.1.0",
"Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...requestOptions?.headers,
},
contentType: "application/json",
requestType: "json",
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000,
maxRetries: requestOptions?.maxRetries,
abortSignal: requestOptions?.abortSignal,
});
Expand Down Expand Up @@ -388,16 +388,16 @@ 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.1.0",
"User-Agent": "intercom-client/6.1.0",
"Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...requestOptions?.headers,
},
contentType: "application/json",
requestType: "json",
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000,
maxRetries: requestOptions?.maxRetries,
abortSignal: requestOptions?.abortSignal,
});
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;
}
}
Loading