# iMessage agent workflow for n8n

Put your product in iMessage with Keiki. Run an n8n AI Agent workflow on your server to answer customers’ questions over text.

[View imessage-n8n-agent on GitHub](https://github.com/Mail-0/imessage-n8n-agent)

## How do I build an iMessage agent with n8n?

1. Create a Keiki agent with an external harness. Clone [Mail-0/imessage-n8n-agent](https://github.com/Mail-0/imessage-n8n-agent), set `KEIKI_AGENT_ID` in `.env`, and set `WEBHOOK_URL` to the public HTTPS base URL for your webhook. Then start the included Docker Compose service.
2. Use a reverse proxy to forward only `POST /webhook/keiki/turn` from that public URL to the local n8n service. Keep the editor private.
3. Import `workflow.json` into n8n, add your model credential, and publish the workflow. In Keiki [push mode](https://onkeiki.com/docs/external-harness#configure-an-agent), use the public Production URL ending in `/webhook/keiki/turn` as the dispatch URL.
4. [Attach an iMessage line](https://onkeiki.com/docs/channels#imessage-lines) and text “How do I schedule a report?” The example AI Agent looks up the answer with a workflow tool.

Your code, your model, your servers. Keiki only handles the channels.

## Details

- Stack: n8n, JSON, Docker Compose, @onkeiki/channels
- Channels: iMessage
- Docs: [/docs/external-harness](https://onkeiki.com/docs/external-harness)
