Once your agent has decided to act on a thread, it uses the GraphQL API to do something. The most common actions are: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.
- Reply directly to the customer.
- Suggest a reply for a teammate to review and send.
- Post a note that’s visible to your team but never the customer.
- Add labels to classify or flag the thread.
- Change the assignee to route the thread or hand it off to a human.
Reply directly
The mutation for sending a reply isreplyToThread. It works on threads whose channel is API, CHAT, EMAIL, SLACK, or MS_TEAMS, and Plain takes care of delivering the message through the right channel. Replies show up in the thread as messages from the agent’s machine user, the same as any other reply.
This operation requires the thread:reply permission.
textContent and markdownContent. textContent is shown in clients that don’t render markdown (some email clients, plain-text contexts), and markdownContent is rendered in the Plain UI, the chat widget, and modern email clients.
See the reply to thread page for the full mutation reference, error codes, and channel-specific options.
Suggest a reply
Instead of sending immediately, your agent can add a reply to the thread as a suggestion. The suggestion shows up in Plain attached to a specific customer message, and a teammate can review it, edit it, and send it (or discard it) from the UI. The customer doesn’t see anything until the teammate sends. This is a great default while you’re tuning an agent. You get all the value of the agent drafting replies without committing to autonomous send. The mutation isaddGeneratedReply. It takes the thread ID, the timelineEntryId of the customer message the reply is for, and the suggested content as markdown:
- The
timelineEntryIdmust point at a customer message. You can get one from the webhook payload (for examplepayload.email.timelineEntryIdonthread.email_received) or by paginating thread timeline entries. markdownis capped at 5,000 characters.- This operation requires the
generatedReply:createpermission.
Post a note
A note is an internal message that lives on the thread’s timeline but is never delivered to the customer. Notes are useful for leaving context for the next teammate who picks up the thread, recording why the agent did (or didn’t) act, or attaching extra information you don’t want to show the customer.Add labels
Labels are useful for classifying threads, flagging them for review, or driving downstream automation (workflows, reporting, or routing rules). A classifier agent that just labels each new thread is one of the simplest agents you can build. You add labels by referencing existing label types, which you create in Plain under Settings → Labels.removeLabels with the IDs of the labels (not label types) you want to remove. See labels for the full reference.
Change the assignee
Reassigning a thread is how your agent hands off to (or accepts handoffs from) the rest of your team. The mutation isassignThread, and AssignThreadInput accepts either a userId or a machineUserId:
Other useful operations
These mutations cover most agents. The samePlainClient exposes everything else available in Plain’s API:
| Action | Mutation |
|---|---|
| Mark as done or move to todo | markThreadAsDone, markThreadAsTodo |
| Send a new outbound email | sendNewEmail |
| Reply to a specific email | replyToEmail |
| Set a custom thread field | upsertThreadField |
| Create a customer event | createCustomerEvent |
Resources
- GraphQL SDK: the typed client your agent calls
- Reply to threads: the full
replyToThreadreference - Suggested replies: the full
addGeneratedReplyreference - Assignment: assigning and unassigning threads
- Labels: adding and removing labels
- API explorer: browse and test queries interactively

