Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .fern/metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"cliVersion": "3.0.2",
"cliVersion": "5.65.3",
"generatorName": "fernapi/fern-typescript-sdk",
"generatorVersion": "3.35.8",
"generatorVersion": "3.107.1",
"generatorConfig": {
"namespaceExport": "Intercom",
"allowCustomFetcher": true,
Expand Down
9 changes: 8 additions & 1 deletion .fernignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,11 @@ LICENSE
REPO_OWNER
tests/integration
.github/workflows/ci.yml
.github/workflows/publish.yml
.github/workflows/publish.yml
README.md
src/BaseClient.ts
src/auth/BearerAuthProvider.ts
src/core/fetcher/makePassthroughRequest.ts
src/core/url/QueryStringBuilder.ts
src/api/index.ts
src/api/types/compat.ts
105 changes: 83 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,27 @@

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

## Project Updates

The TypeScript SDK has been updated to support latest API version (2.11).
## Table of Contents

- [Installation](#installation)
- [Reference](#reference)
- [Usage](#usage)
- [Environments](#environments)
- [Request and Response Types](#request-and-response-types)
- [Exception Handling](#exception-handling)
- [Pagination](#pagination)
- [Advanced](#advanced)
- [Additional Headers](#additional-headers)
- [Additional Query String Parameters](#additional-query-string-parameters)
- [Retries](#retries)
- [Timeouts](#timeouts)
- [Aborting Requests](#aborting-requests)
- [Access Raw Response Data](#access-raw-response-data)
- [Logging](#logging)
- [Custom Fetch](#custom-fetch)
- [Custom Fetcher](#custom-fetcher)
- [Runtime Compatibility](#runtime-compatibility)
- [Contributing](#contributing)

## Installation

Expand All @@ -17,7 +35,7 @@ npm i -s intercom-client

## Reference

A full reference for this library is available [here](https://github.com/intercom/intercom-node/blob/HEAD/./reference.md).
A full reference for this library is available [here](./reference.md).

## Usage

Expand All @@ -32,7 +50,19 @@ await client.aiContent.createContentImportSource({
});
```

## Request And Response Types
## Environments

This SDK allows you to configure different environments for API requests.

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

const client = new IntercomClient({
environment: IntercomEnvironment.UsProduction,
});
```

## Request and Response Types

The SDK exports all request and response types as TypeScript interfaces. Simply import them with the
following namespace:
Expand Down Expand Up @@ -81,7 +111,7 @@ for await (const item of pageableResponse) {
// Or you can manually iterate page-by-page
let page = await client.articles.list();
while (page.hasNextPage()) {
page = page.getNextPage();
page = await page.getNextPage();
}

// You can also access the underlying response
Expand All @@ -95,6 +125,15 @@ const response = page.response;
If you would like to send additional headers as part of the request, use the `headers` request option.

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

const client = new IntercomClient({
...
headers: {
'X-Custom-Header': 'custom value'
}
});

const response = await client.aiContent.createContentImportSource(..., {
headers: {
'X-Custom-Header': 'custom value'
Expand All @@ -120,11 +159,10 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque
as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
retry limit (default: 2).

A request is deemed retryable when any of the following HTTP status codes is returned:

Requests are retried on:
- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500)

Use the `maxRetries` request option to configure this behavior.

Expand All @@ -136,7 +174,7 @@ const response = await client.aiContent.createContentImportSource(..., {

### Timeouts

The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.
The SDK defaults to a 20 second timeout. Use the `timeoutInSeconds` option to configure this behavior.

```typescript
const response = await client.aiContent.createContentImportSource(..., {
Expand Down Expand Up @@ -231,21 +269,29 @@ const logger: logging.ILogger = {
</details>


### Runtime Compatibility


The SDK works in the following runtimes:
### Custom Fetch

The SDK provides a low-level `fetch` method for making custom HTTP requests while still
benefiting from SDK-level configuration like authentication, retries, timeouts, and logging.
The auth header is only sent to the client's configured environment, so set `environment` to
call a regional host such as `https://api.eu.intercom.io`.
This is useful for calling API endpoints not yet supported in the SDK.

```typescript
const response = await client.fetch("/v1/custom/endpoint", {
method: "GET",
}, {
timeoutInSeconds: 30,
maxRetries: 3,
headers: {
"X-Custom-Header": "custom-value",
},
});

- Node.js 18+
- Vercel
- Cloudflare Workers
- Deno v1.25+
- Bun 1.0+
- React Native
const data = await response.json();
```

### Customizing Fetch Client
### Custom Fetcher

The SDK provides a way for you to customize the underlying HTTP client / Fetch function. If you're running in an
unsupported environment, this provides a way for you to break glass and ensure the SDK works.
Expand All @@ -259,6 +305,21 @@ const client = new IntercomClient({
});
```

### Runtime Compatibility


The SDK works in the following runtimes:



- Node.js 18+
- Vercel
- Cloudflare Workers
- Deno v1.25+
- Bun 1.0+
- React Native


## Contributing

While we value open-source contributions to this SDK, this library is generated programmatically.
Expand All @@ -267,4 +328,4 @@ otherwise they would be overwritten upon the next generated release. Feel free t
a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
an issue first to discuss with us!

On the other hand, contributions to the README are always very welcome!
On the other hand, contributions to the README are always very welcome!
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "intercom-client",
"version": "7.0.3",
"version": "7.1.0",
"private": false,
"repository": "github:intercom/intercom-node",
"type": "commonjs",
Expand Down
Loading
Loading