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

# Connect Modem to your Plain workspace

> Connect Modem to Plain so it captures your support threads and groups them into topics.

Modem captures your Plain threads as they happen: customer emails and chats, your team's replies, and internal notes. It groups them into topics and links each message to the person and company behind it. Your team then asks the Modem Agent about them in Modem, Slack, or Discord.

Modem connects as an internal [connected agent](https://www.plain.com/docs/product/agents/bring-your-own-agent.md). It reads your threads with an API key and adds its own [webhook](https://www.plain.com/docs/webhooks.md) to hear about new activity. It can't message your customers unless you give its key permission to.

## Before you start

You need the **Owner or admin role in your Modem organization** to connect Plain from Modem's settings.

> [!NOTE]
>
> Modem's webhook subscribes to email, chat, and note events. It doesn't subscribe to Slack, Microsoft Teams, or Discord message events.

## Steps

**1. Create the connected agent**

In Plain, go to **Agents → Connected agents → Add agent**. Or your AI agent can do this step for you through Plain's MCP server, following [Connected agent set up](https://www.plain.com/docs/connected-agent-setup.md). Name the agent Modem and pick the **Internal Agent** template.

**2. Create its API key**

Plain opens the API key step with the Internal template's permissions already selected. They cover what Modem reads: threads and their messages, customers, labels, teammates, and machine users. Add these two, so Modem can add its webhook when you connect and remove it when you disconnect:

* `webhookTarget:create`
* `webhookTarget:delete`

Create the key and copy it. On the webhook step, click **Skip for now**. Modem adds its own webhook in the next step, so a webhook you add here would duplicate it.

**3. Connect Plain in Modem**

In Modem, go to **Settings → Integrations → Plain**, paste the API key, and click **Connect Plain**.

Modem shows **Connected to** and your workspace's name. Under **API key permissions**, it shows **Every required permission is granted**. If it lists a missing permission instead, add it to the key in Plain and click **Check again**.

Modem adds its webhook under **Settings → Webhooks** in Plain. The webhook isn't linked to the Modem agent, so it doesn't show on the agent's **Webhooks** tab.

**4. Check new messages reach Modem**

Send an email to your workspace's support address from your own email address. Modem captures the new thread within a few minutes.

If nothing arrives, click **Disconnect** on Modem's Plain page, then connect again. Modem adds a fresh webhook when it reconnects.

## Let Modem act on threads

When your team asks it to, the Modem Agent can act on Plain threads. With the Internal template's permissions, it can already add internal notes and add or remove labels. To let it do more, edit Modem's API key in Plain, add the permissions below, then click **Check again** in Modem:

| Permission | Lets the Modem Agent |
| - | - |
| `thread:edit` | Mark a thread done or todo, snooze it, or change its priority |
| `thread:assign`, `thread:unassign` | Assign or unassign a thread |
| `thread:reply` | Reply to the customer through the thread's channel, under the agent's public name |

Modem asks you to approve each action before it runs, unless you set that action to always run.

## Disconnect Modem

In Modem, go to **Settings → Integrations → Plain**, click **Disconnect**, and confirm. Modem deletes its webhook in Plain while its API key still works.

Disconnect in Modem before you delete the Modem agent in Plain. Deleting the agent removes its API key, so Modem can't delete its webhook. You then delete the webhook yourself under **Settings → Webhooks**.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.