Skip to main content
For developers building AI agents with n8n, Make, or any agent framework. This guide covers the multi-tenant pattern: create inbox, inject env vars, route inbound by inbox_id. For LangChain or Vercel AI SDK, see Agent frameworks for ready-made tool definitions. For OpenClaw, use the channel plugin instead; a pod account covers every inbox you create.

Prerequisites

Use this pre-built prompt to get started faster.

Open in Cursor

Step 1: Create an inbox and its key

Two API calls. Create the inbox, then mint an inbox-scoped key for it. The agent gets only that key, so a compromised container can reach nothing but its own inbox. Map inbox_id to your user/container in your app for routing.
Minting needs an account-wide key, or a pod key for the inbox’s pod. An inbox-scoped key cannot mint.

Step 2: Write env vars into the container

Three variables per container, all unique to it. Your account or pod key never enters the container.
Inject them into your agent’s environment (e.g. LangChain tool config, n8n node credentials, a Docker --env-file).

Step 3: Add the skill file

This file teaches the agent how to send and receive email. Most frameworks load it into the system prompt or expose it as a tool description. The agent calls the API via curl—no CLI binary needed. Place it in your agent’s skills directory (for Claude Code, ~/.claude/skills/openmail/SKILL.md) or pre-bake it into your Docker image. The content is the same for every framework.
SKILL.md
Pre-bake into Docker - the skill file is identical for every agent. Only the env vars differ per container: COPY skills/openmail/SKILL.md /root/.claude/skills/openmail/SKILL.md

Step 4: Handle inbound email

Choose your delivery method. WebSockets are recommended for agents - no public URL needed, instant delivery. Webhooks work for traditional server-to-server integrations. The event payload is identical for both methods:
Event payload

Verify the integration

  1. Create inbox - confirm OPENMAIL_INBOX_ID and OPENMAIL_ADDRESS appear in the container’s env
  2. Send - tell the agent “send an email to your-test@email.com” - confirm it arrives
  3. Inbound - reply to that email; confirm the event arrives over your WebSocket connection (or webhook) and routes to the container
  4. Thread - tell the agent “reply to the last email” - confirm the reply threads correctly in the recipient’s client

Reference

Email deliverability

Warm-up schedules, inbox distribution, and content best practices to stay out of spam.

WebSockets

Real-time event streaming, subscribe protocol, reconnection.

Webhooks

Signature verification, payload format, retries.

API reference

Full endpoint documentation.