Connect your own agent to Envoy
Envoy Assistant is a voice app for Meta AI glasses. When you ask it to hand something to your agent (a Grok Bot routine, an n8n flow, Home Assistant, a script on your server), the agent's answer comes back through this relay and Envoy reads it out loud. The relay is a small mailbox: it only knows the phones and agents that paired with each other, and it deletes each message as soon as the phone has it.
Base URL: https://envoy-relay.metarch.workers.dev
How it works
- Pair. In Envoy: Settings → Agent connections → Pair an agent. The app shows a code like
ENV-7KQ4-M2XD. It works once and expires after 15 minutes. - Your agent redeems the code with
POST /v1/pairand gets its own agent token. The token only reaches that one phone. Keep it secret (a password manager, an env file, a secret store). - Asking (phone → agent). Optional: in the same screen, give the connection your agent's webhook URL
and Authorization header. When you ask a persona to "check with my agent", Envoy POSTs the request there,
including an
ask_id. - Answering (agent → phone). The agent posts the answer with
POST /v1/messagesandreply_toset to thatask_id. Envoy picks it up within a few seconds and the persona reads it out. Withoutreply_tothe message is a notice: it is read out in a live chat or shown as a notification. - Briefs (optional). Short context notes (
PUT /v1/briefs/<slot>) that Envoy adds to a persona's instructions at the start of each chat: slotsharedfor every persona, or a slot named after a persona (lowercase name, e.g.envoy,sage).
Quick start with curl
1. Pair (once)
curl -sS -X POST https://envoy-relay.metarch.workers.dev/v1/pair \
-H 'content-type: application/json' \
-d '{"code":"ENV-7KQ4-M2XD","name":"My home server"}'
# → {"agent_id":"…","device_id":"…","name":"My home server","agent_token":"eva_…"}
# Store agent_token somewhere private. It is shown only once.
2. Send a message or a reply
export ENVOY_AGENT_TOKEN='eva_…' # from step 1
curl -sS -X POST https://envoy-relay.metarch.workers.dev/v1/messages \
-H "Authorization: Bearer $ENVOY_AGENT_TOKEN" -H 'content-type: application/json' \
-d '{"text":"Your 3pm moved to 4pm.","from":"Home server"}'
# Answer a request Envoy sent to your webhook (use its ask_id):
curl -sS -X POST https://envoy-relay.metarch.workers.dev/v1/messages \
-H "Authorization: Bearer $ENVOY_AGENT_TOKEN" -H 'content-type: application/json' \
-d '{"reply_to":"ASK_ID_FROM_THE_WEBHOOK","text":"Garage door is closed."}'
3. Keep a brief (optional)
curl -sS -X PUT https://envoy-relay.metarch.workers.dev/v1/briefs/shared \
-H "Authorization: Bearer $ENVOY_AGENT_TOKEN" -H 'content-type: application/json' \
-d '{"text":"Travelling in Lisbon until Friday. Prefers metric units."}'
curl -sS -X DELETE https://envoy-relay.metarch.workers.dev/v1/briefs/shared -H "Authorization: Bearer $ENVOY_AGENT_TOKEN"
4. Check or remove the connection
curl -sS https://envoy-relay.metarch.workers.dev/v1/agent -H "Authorization: Bearer $ENVOY_AGENT_TOKEN"
curl -sS -X DELETE https://envoy-relay.metarch.workers.dev/v1/agent -H "Authorization: Bearer $ENVOY_AGENT_TOKEN" # unpair yourself
What Envoy sends to your webhook
If you set an ask webhook for a connection, each hand-off is one POST with your Authorization header:
{
"source": "envoy", "kind": "ask", "ask_id": "k3J…", "reply_token": "k3J…",
"agent": "My home server", "persona": "My home server", "mode": "answer",
"request": "Is the garage door closed?", "context": ["You: …", "Envoy: …"],
"asked_via_persona": "Envoy", "created_at": "2026-11-23T20:15:04Z",
"envoy_relay": {"url": "https://envoy-relay.metarch.workers.dev", "reply": "POST /v1/messages with reply_to = ask_id"}
}
mode is answer (a quick lookup: reply within about 20 seconds so it lands in the
live chat; later replies are still delivered) or follow_up (real work: answer in your own app; a
short relay message like "On it" is optional). Reply in 1 to 3 short spoken-style sentences; no markdown.
Recipes
Grok Bot (or any chat agent with a webhook routine and a shell)
Create a webhook routine, paste its URL and Authorization header into the Envoy connection, and add to the
routine prompt: "Requests arrive as JSON with kind=ask. Do what's asked. For mode=answer, reply with
curl -X POST https://envoy-relay.metarch.workers.dev/v1/messages using the agent token stored in my secret file, with
reply_to set to ask_id and a 1-3 sentence spoken answer." Pair once by telling the
agent the code and asking it to run step 1 and save the token without printing it.
n8n
Webhook trigger (the ask webhook) → your workflow → HTTP Request node: POST https://envoy-relay.metarch.workers.dev/v1/messages,
header Authorization: Bearer {{ $credentials… }} (a Header Auth credential holding the agent token),
JSON body {"reply_to": "{{$json.body.ask_id}}", "text": "…"}.
Home Assistant
# configuration.yaml — token in secrets.yaml as envoy_auth: "Bearer eva_…"
rest_command:
envoy_notify:
url: "https://envoy-relay.metarch.workers.dev/v1/messages"
method: POST
headers: { Authorization: !secret envoy_auth }
content_type: application/json
payload: '{"text": "{{ message }}", "from": "Home"}'
Use a webhook-triggered automation as the ask webhook and answer with reply_to to make it two-way.
Endpoints
| Method and path | Token | What it does |
|---|---|---|
POST /v1/pair | none (code) | Redeem a pairing code. Body {"code","name"}. Returns agent_token once. |
POST /v1/messages | agent | Body {"text" (≤4000 chars), "reply_to"?, "from"?, "kind"?: "reply"|"notice", "ttl_seconds"? (60–86400)}. |
PUT /v1/briefs/<slot> | agent | Body {"text"} (≤4 KB; empty text deletes). Slot: [a-z0-9_-]{1,32}. Kept 30 days. |
DELETE /v1/briefs/<slot> | agent | Remove a brief. |
GET /v1/agent · DELETE /v1/agent | agent | Who am I · unpair. |
POST /v1/devices | none | (Envoy app) register a phone. |
POST /v1/device/pairing-code | device | (Envoy app) new code; replaces the previous one. |
GET /v1/device/agents · DELETE /v1/device/agents/<id> | device | (Envoy app) list or remove paired agents. |
GET /v1/device/messages · POST /v1/device/ack | device | (Envoy app) fetch waiting messages; ack deletes them. |
GET /v1/device/briefs · DELETE /v1/device | device | (Envoy app) read briefs · delete everything for this phone. |
GET /v1/health | none | Liveness. |
Errors are JSON {"error": "…"} with 400 / 401 / 404 / 409 / 413 / 429 (with retry_after_s).
Limits and retention
- Messages: up to 4,000 characters; deleted as soon as the phone acknowledges them, otherwise after their TTL (default and maximum 24 hours). At most 50 waiting per phone.
- Briefs: up to 4 KB each, 16 slots per phone, kept 30 days after the last update (or until deleted).
- Agents: up to 10 per phone; each can send 30 requests a minute and 1,000 a day.
- Pairing codes: single use, 15 minutes, a new code cancels the previous one. Pairing and registration are rate-limited per IP address.
- Request bodies: 16 KB max.
- Only SHA-256 hashes of tokens are stored. There are no accounts, no analytics, and no message logs.
Security notes
- An agent token can post to one phone and nothing else; it can't read messages or other agents' data. Anyone with the token can make Envoy read text aloud, so treat it like a password.
- Remove an agent from Envoy (Settings → Agent connections) to revoke its token immediately.
- Envoy never sends your AI provider key, your audio, or your transcripts to this relay.
Envoy Assistant · Privacy · Terms · support: hello@metarch.photography