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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
218 changes: 218 additions & 0 deletions docs/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -2006,3 +2006,221 @@ api.deleteReportingWebhook(4);
#### Options

- **webhookId**: The webhook's numeric id (required)

## Content & sender utilities

### Snippets

Manage [snippets](https://customer.io/docs/journeys/snippets/) — reusable content blocks referenced from messages. Snippets are identified by `name`.

### api.getSnippets()

List the snippets in your workspace.

```javascript
api.getSnippets();
```

### api.createSnippet(snippet)

Create a snippet.

```javascript
api.createSnippet({ name: "footer", value: "<p>© 2026 Example</p>" });
```

#### Options

- **snippet**: The snippet definition
- _name_: The snippet's unique name/key (required)
- _value_: The snippet's value; may contain Liquid (required)

### api.updateSnippet(snippet)

Create or update a snippet (upsert by name).

```javascript
api.updateSnippet({ name: "footer", value: "<p>© 2027 Example</p>" });
```

#### Options

- **snippet**: The snippet definition — `name` and `value` (both required)

### api.deleteSnippet(name)

Delete a snippet by name. Returns no content on success. Fails if the snippet is still in use.

```javascript
api.deleteSnippet("footer");
```

#### Options

- **name**: The snippet's name (required)

### Sender identities

### api.getSenderIdentities(options)

List the sender identities in your workspace.

```javascript
api.getSenderIdentities({ limit: 50, sort: "asc" });
```

#### Options

- **options**: Object (optional) — `start`, `limit`, `sort` ("asc" / "desc"), `hidden` (omit for all, `true`/`false` to filter)

### api.getSenderIdentity(senderId)

Get a single sender identity.

```javascript
api.getSenderIdentity(12);
```

#### Options

- **senderId**: The sender identity's numeric id (required)

### api.getSenderIdentityUsedBy(senderId)

List the campaigns and newsletters that use a sender identity.

```javascript
api.getSenderIdentityUsedBy(12);
```

#### Options

- **senderId**: The sender identity's numeric id (required)

### Messages

Look up sent messages (deliveries) across your workspace. For a single person's messages, use [`getCustomerMessages`](#apigetcustomermessagescustomerid-options).

### api.getMessages(options)

List sent messages.

```javascript
api.getMessages({ metric: "delivered", type: "email", limit: 50 });
```

#### Options

- **options**: Object (optional)
- _start_: Pagination cursor from a previous page's `next`
- _limit_: Maximum number of results
- _drafts_: Return only drafts (`true`) or exclude them (default)
- _metric_: Filter to a delivery metric (e.g. `delivered`, `opened`, `bounced`)
- _type_: Scope to a channel ("email" / "webhook" / "twilio" / "whatsapp" / "slack" / "push" / "in_app")
- _campaign_id_ / _action_id_ / _newsletter_id_ / _transactional_id_ / _trigger_id_ / _template_id_ / _content_id_: Scope to a single resource
- _start_ts_ / _end_ts_: Unix timestamp bounds (seconds)
- _associations_: Include related campaigns/actions/newsletters/contents
- _get_tracked_responses_: Include tracked responses on each delivery

### api.getMessage(messageId, options)

Get a single sent message.

```javascript
api.getMessage("RPCImftJDcAAAAd...", { archived_message: true });
```

#### Options

- **messageId**: The delivery id (`CIO-Delivery-ID`) (required)
- **options**: Object (optional) — `archived_message`, `associations`, `get_tracked_responses`

### api.getArchivedMessage(messageId)

Get the archived content of a single sent message.

```javascript
api.getArchivedMessage("RPCImftJDcAAAAd...");
```

#### Options

- **messageId**: The delivery id (`CIO-Delivery-ID`) (required)

## Imports, data index & workspace info

### api.createImport(importData)

Start a [CSV import](https://customer.io/docs/api/app/#operation/createImports). The CSV is loaded from a hosted URL you provide as `data_file_url`.

```javascript
api.createImport({
data_file_url: "https://example.com/people.csv",
type: "people",
identifier: "email",
name: "Q3 signups",
});
```

#### Options

- **importData**: The import definition
- _data_file_url_: URL of the CSV file to import (required)
- _type_: `"people"` / `"event"` / `"object"` / `"relationship"` (required)
- _identifier_: Which column keys the rows — `"id"`/`"email"` for people & events; `"id"`/`"email"`/`"cio_id"` for relationships
- _object_type_id_: Required when `type` is `"object"`
- _name_: Display name (defaults to the filename)
- _description_: Description of the import
- _people_to_process_ / _data_to_process_: `"all"` / `"only_existing"` / `"only_new"` (mutually exclusive)

### api.getImport(importId)

Get the status of an import.

```javascript
api.getImport(15);
```

#### Options

- **importId**: The import's numeric id (required)

### api.batchUpdateAttributes(attributes)

Batch-update attribute metadata (descriptions, etc.) — up to 100 at a time.

```javascript
api.batchUpdateAttributes([{ name: "plan", description: "Subscription plan" }]);
```

#### Options

- **attributes**: A non-empty array of attribute updates (max 100). Each requires a `name`; may also include `description`, `object_type_id`, `is_relationship`, `event_name`, `privacy_level`

### api.batchUpdateEvents(events)

Batch-update event metadata — up to 100 at a time.

```javascript
api.batchUpdateEvents([{ name: "purchase", description: "Completed a purchase" }]);
```

#### Options

- **events**: A non-empty array of event updates (max 100). Each requires a `name`; may also include `description`

### api.listWorkspaces()

List the workspaces (environments) in your account, with usage counts.

```javascript
api.listWorkspaces();
```

### api.getIpAddresses()

List the Customer.io egress IP addresses (for allowlisting).

```javascript
api.getIpAddresses();
```
Loading