Your agent finds out about new threads and customer messages by receiving webhooks from Plain. This page covers the setup and the events that are most useful when building an agent.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.
Set up a webhook endpoint
You need a publicly available HTTPS endpoint that acceptsPOST requests. Once you have one, go to Settings → Webhooks in Plain and click + Add webhook target. Choose the URL, the events you want to receive, and copy the signing secret. You’ll need it to verify webhook signatures.
See the webhooks overview for the full setup, including delivery semantics, retries, and security options like request signing and mTLS.
Verify and parse events with the SDK
The@team-plain/webhooks package handles signature verification, replay protection, and JSON schema validation, and gives you fully typed event payloads.
parsePlainWebhook to skip the signature check and just validate the payload shape. See the Webhooks SDK reference for the full API.
Events that matter for an agent
These are the events agents most commonly subscribe to.| Event | When it fires |
|---|---|
thread.thread_created | A new thread is created in your workspace, regardless of which channel it came from. |
thread.email_received | A customer email arrives. Fires for the first email and every reply. |
thread.chat_received | A customer sends a chat message via the chat widget. |
thread.slack_message_received | A customer posts in a connected Slack channel. |
thread.thread_assignment_transitioned | A thread’s assignee changes. Use this if your agent should only run when assigned. |
thread.thread_status_transitioned | A thread moves between TODO, SNOOZED, and DONE. |
If you subscribe to both
thread.thread_created and thread.email_received you’ll get two events for the first email in a thread. Check the isStartOfThread field on the email payload if you only want to react once.
