Skip to main content
Devin can answer your team in discussions on a thread, as an internal connected agent. It investigates your codebase and uses your tools to answer. It never messages the customer. You don’t run a service for Devin. Plain sends each discussion message to a managed webhook in Devin, and a Devin automation starts a session that answers through Plain’s API.

Before you start

You need these before you connect Devin:
  • Admin access in Devin: you create a secret, a managed webhook and an automation in your Devin organization
  • Devin connected to your code: connect Devin to your repositories and any other tools you use
Connected agents use credits each time a discussion with them starts.
Let your AI agent do the steps that don’t involve a secret, with Plain’s MCP server and Devin’s MCP server connected. Devin’s MCP server signs in with a service user’s key, which you create in Devin under Settings → Devin API → Service users. You create the API keys and copy the secrets yourself: don’t paste API keys or secrets into your AI agent’s chat.

Steps

1

Create the connected agent

In Plain, go to Agents → Connected agents → Add. Or your AI agent can do this step for you through Plain’s MCP server, following Connected agent set up. Name the agent Devin and pick the Internal Agent template. Note the agent’s ID: it starts with mu_.
2

Create its API key

Plain opens the API key step with the template’s permissions already selected. Create the key, then in Devin go to Settings → Secrets → Organization and add it as PLAIN_API_KEY. Skip the webhook step for now: you add it in step 5.
3

Create a managed webhook in Devin

In Devin, go to Settings → Managed webhooks → New managed webhook and fill in:
  • Name: Plain
  • Authentication: Custom header, with the header name X-Webhook-Secret
  • Secret lifetime: Never expires. If the secret expires, Plain’s deliveries start failing
  • Delivery ID: the Plain-Event-Id header. Plain sends the same ID on every retry, so Devin drops duplicates
  • Sample payload: paste the sample payload below, a discussion.message_created event
Click Create webhook. Devin shows the X-Webhook-Secret once, so save it. Note the webhook’s endpoint URL too.
4

Create the automation

In Devin, go to Automations and create an automation. Or your AI agent can do this step for you through Devin’s MCP server. Fill in:
  • Automation name: Plain
  • Triggers: Add trigger → Plain (Managed)
  • Add Preflight check: pick Run a script, choose Node, and paste the Preflight script below. It lets an event through only when a user writes in a discussion with Devin, so no session starts for anything else. Replace your_agent_id_here with the agent’s ID from step 1
  • Agent type: Start new session. Don’t pick Message existing session: every discussion in your workspace would pile into the same Devin session
  • Instructions: paste Devin’s prompt below. It calls Plain’s API with the PLAIN_API_KEY secret from step 2
  • Advanced → Network policy: click Add domain and add core-api.uk.plain.com. The policy starts with only git-manager.devin.ai, so without it Devin can’t reach Plain’s API
Click Create automation.
5

Add the webhook in Plain

On the Devin agent’s Webhooks tab, add a webhook with the managed webhook’s endpoint from step 3 as the URL and the discussion.message_created event. Under Custom headers, click Add header and add X-Webhook-Secret with the secret from step 3, so Devin accepts Plain’s requests.
6

Send discussions to Devin

On a thread, open Ask Agent and pick Devin. Or add a workflow with a Start Agent discussion step that picks Devin. Devin shows as working, posts its answer in the discussion, then goes idle.If no answer arrives, check the automation ran in Devin. Your AI agent can check the agent’s API key and webhook through Plain’s MCP server.