> ## Documentation Index
> Fetch the complete documentation index at: /llms.txt
> Use this file to discover all available pages before exploring further.

# Plain

> Plain is a collaborative support platform for B2B support teams, offering a modern, AI-powered interface to consolidate support channels and assist customers efficiently

Plain is a collaborative support platform for B2B support teams, offering a modern, AI-powered interface to consolidate support channels and assist customers efficiently.

`plain` · **23 tools** · **11 triggers**

## Connect it

```bash
run auth plain
run auth plain --scope team    # shared with the organization
```

Or from the [Integrations page](https://app.boxd.sh/integrations) in the console. See [Connections](/guides/integrations/connections.md) for personal versus shared, and who may remove one.

## Use it

```bash
run plain          # common commands
run plain --all    # every command
```

```ts
import { plain } from "@boxd/run";
```

## Common tools

| Tool | What it does |
| - | - |
| `add-customer-to-group` | Tool to add a customer to one or more customer groups. Use when you have a customer and groups ready. |
| `create-customer-group` | Creates a new customer group in Plain for organizing and segmenting customers. |
| `create-thread` | Tool to create a new thread. Use after obtaining valid customer identifier. |
| `delete-customer` | Tool to delete a customer from the system. Use when you need to remove a customer by their ID. |
| `delete-user` | Tool to delete a user from the system. Use when you need to remove a user by their ID after confirming existence. |
| `fetch-company` | Tool to fetch company details by ID. Use when you need the full profile of a company, including name, domain, contract value, owner info, and timestamps. |
| `fetch-issues` | Fetches external issue tracker links (Jira, Linear, GitHub, etc.) associated with a customer's threads. |
| `fetch-tier` | Tool to fetch a tier by its ID. Use when you have a tier ID and need its metadata before proceeding. |
| `get-customer-by-email` | Fetch customer details by email address. Returns customer information if found, or null if no customer exists with that email. |
| `get-customer-by-id` | Tool to retrieve details of a specific customer by their unique ID. |
| `get-customers` | Tool to fetch a list of customers. Use when retrieving multiple customer records with pagination, filtering, or sorting. |
| `get-thread-by-id` | Fetches comprehensive details of a specific thread by ID, including customer info, status, priority, labels, and assignments. |
| `get-user-by-id` | Fetch workspace user/team member by ID. Returns detailed information about a workspace team member including their name, email, status, and avatar. |
| `list-customer-groups` | Tool to list all customer groups. Use when you need to retrieve group metadata with optional pagination or filters. |
| `list-threads` | DEPRECATED: Use PLAIN\_PLAIN\_QUERY\_THREADS instead. Lists all threads (support conversations) in Plain. |
| `list-tiers` | Tool to retrieve a list of tiers with pagination. Use when you need to browse available tiers after determining pagination cursors. |
| `query-threads` | Tool to retrieve a paginated list of threads. Use when you need to list threads with optional status filtering. |
| `remove-customer-from-group` | Removes a customer from one or more customer groups in Plain. |
| `run-graphql-query` | Execute any GraphQL query or mutation against Plain API. Use when no specific action exists or for complex operations like thread timelines, advanced... |
| `send-message` | Tool to send a new message within a thread. Use after identifying the thread and preparing message content. |
| `update-company` | Upserts (creates or updates) a company in Plain. Provide either companyId (for updating an existing company by ID) or companyDomainName (for upserting by domain). |
| `update-thread` | Tool to update a thread's title. Use when renaming a thread after confirming its ID. |
| `upsert-customer` | Tool to upsert (create or update) a customer. Use when syncing or ensuring a customer record exists before subsequent actions. |

> [accordion] All 23 tools
>
> | Tool | What it does |
> | - | - |
> | `add-customer-to-group` | Tool to add a customer to one or more customer groups. Use when you have a customer and groups ready. |
> | `create-customer-group` | Creates a new customer group in Plain for organizing and segmenting customers. |
> | `create-thread` | Tool to create a new thread. Use after obtaining valid customer identifier. |
> | `delete-customer` | Tool to delete a customer from the system. Use when you need to remove a customer by their ID. |
> | `delete-user` | Tool to delete a user from the system. Use when you need to remove a user by their ID after confirming existence. |
> | `fetch-company` | Tool to fetch company details by ID. Use when you need the full profile of a company, including name, domain, contract value, owner info, and timestamps. |
> | `fetch-issues` | Fetches external issue tracker links (Jira, Linear, GitHub, etc.) associated with a customer's threads. |
> | `fetch-tier` | Tool to fetch a tier by its ID. Use when you have a tier ID and need its metadata before proceeding. |
> | `get-customer-by-email` | Fetch customer details by email address. Returns customer information if found, or null if no customer exists with that email. |
> | `get-customer-by-id` | Tool to retrieve details of a specific customer by their unique ID. |
> | `get-customers` | Tool to fetch a list of customers. Use when retrieving multiple customer records with pagination, filtering, or sorting. |
> | `get-thread-by-id` | Fetches comprehensive details of a specific thread by ID, including customer info, status, priority, labels, and assignments. |
> | `get-user-by-id` | Fetch workspace user/team member by ID. Returns detailed information about a workspace team member including their name, email, status, and avatar. |
> | `list-customer-groups` | Tool to list all customer groups. Use when you need to retrieve group metadata with optional pagination or filters. |
> | `list-threads` | DEPRECATED: Use PLAIN\_PLAIN\_QUERY\_THREADS instead. Lists all threads (support conversations) in Plain. |
> | `list-tiers` | Tool to retrieve a list of tiers with pagination. Use when you need to browse available tiers after determining pagination cursors. |
> | `query-threads` | Tool to retrieve a paginated list of threads. Use when you need to list threads with optional status filtering. |
> | `remove-customer-from-group` | Removes a customer from one or more customer groups in Plain. |
> | `run-graphql-query` | Execute any GraphQL query or mutation against Plain API. Use when no specific action exists or for complex operations like thread timelines, advanced... |
> | `send-message` | Tool to send a new message within a thread. Use after identifying the thread and preparing message content. |
> | `update-company` | Upserts (creates or updates) a company in Plain. Provide either companyId (for updating an existing company by ID) or companyDomainName (for upserting by domain). |
> | `update-thread` | Tool to update a thread's title. Use when renaming a thread after confirming its ID. |
> | `upsert-customer` | Tool to upsert (create or update) a customer. Use when syncing or ensuring a customer record exists before subsequent actions. |

## Triggers (11)

Subscribe with `.on(...)` in a script. A trigger with required configuration takes it as the second argument.

| Trigger | Needs | What fires it |
| - | - | - |
| Customer Event | nothing | Fires when a customer in Plain is created, updated or deleted. |
| Customer Group Changed | nothing | Fires when a customer group is created, edited or deleted in Plain. |
| Customer Group Membership Changed | nothing | Fires when a customer is added to or removed from a customer group in Plain. |
| Thread Created | nothing | Fires when a new support thread is opened in Plain. |
| Thread Custom Field Updated | nothing | Fires when one of your own thread fields is set, changed or cleared on a Plain thread. |
| Thread Message Received | nothing | Fires when an inbound message arrives on a Plain thread. |
| Thread Message Sent | nothing | Fires when your team sends a message out on a Plain thread. |
| Thread Note Created | nothing | Fires when an internal note is added to a thread in Plain. |
| Thread Note Mention Created | nothing | Fires when an internal note mentions a machine user in Plain. |
| Thread Properties Updated | nothing | Fires when a thread's status, assignee, priority or labels change in Plain. |
| Thread Tenant Updated | nothing | Fires when a thread's tenant is set, changed or cleared in Plain. |

[Open Plain in the console →](https://app.boxd.sh/integrations/detail/plain)
