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

# n8n Setup

> Connect Poku Inbox to an external agent brain (e.g., Retell.ai) via n8n.

If your AI agent already lives on another platform, you can wire Poku Inbox into it via n8n. This example uses [Retell.ai](https://retell.ai) as the agent brain.

<Frame>
  <img src="https://mintcdn.com/pokulabs-b271f9f5/D3wi1Up-8W-c-ssP/images/n8n.png?fit=max&auto=format&n=D3wi1Up-8W-c-ssP&q=85&s=7a2c02d0b79662b2ed789ff509fb5def" alt="n8n workflow overview" width="1661" height="470" data-path="images/n8n.png" />
</Frame>

***

## Prerequisites

Before setting up, grab your **Poku API key** from the [Poku dashboard](https://dashboard.pokulabs.com/). You'll need it to enable the agent toggle in your workflow.

***

## How it works

<Steps>
  <Step title="Incoming Twilio message">
    Incoming Twilio messages arrive at your n8n workflow.
  </Step>

  <Step title="Check for existing conversation">
    The workflow checks whether a conversation already exists for the incoming phone number:

    * **No existing conversation** — a new chat is created.
    * **Existing conversation** — the chat is updated with the new message.
  </Step>

  <Step title="Poku toggle check">
    Poku checks whether the agent is enabled before forwarding the message to your Retell agent.

    **Agent OFF** — the workflow stops; the message is not forwarded to the agent.

    <Frame>
      <img src="https://mintcdn.com/pokulabs-b271f9f5/D3wi1Up-8W-c-ssP/images/Humanmode.png?fit=max&auto=format&n=D3wi1Up-8W-c-ssP&q=85&s=4973de5a800b61b5a56ca26c0699f8fb" alt="Human mode — agent off" width="125" height="56" data-path="images/Humanmode.png" />
    </Frame>

    **Agent ON** — the message continues to your Retell agent, which generates and sends a reply.

    <Frame>
      <img src="https://mintcdn.com/pokulabs-b271f9f5/D3wi1Up-8W-c-ssP/images/AImode.png?fit=max&auto=format&n=D3wi1Up-8W-c-ssP&q=85&s=cb105da1f08a610d68f1f83cbb83ec6f" alt="AI mode — agent on" width="125" height="59" data-path="images/AImode.png" />
    </Frame>
  </Step>
</Steps>

***

## Import the workflow

<a href="/files/poku-inbox-n8n.json" download>Download the n8n workflow</a> and import it into your n8n account.

<Warning>
  After importing, replace all placeholder credentials with your own Twilio, Retell, and Poku API key details.
</Warning>
