Envoy Assistant · relay API v1

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

  1. 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.
  2. Your agent redeems the code with POST /v1/pair and gets its own agent token. The token only reaches that one phone. Keep it secret (a password manager, an env file, a secret store).
  3. 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.
  4. Answering (agent → phone). The agent posts the answer with POST /v1/messages and reply_to set to that ask_id. Envoy picks it up within a few seconds and the persona reads it out. Without reply_to the message is a notice: it is read out in a live chat or shown as a notification.
  5. Briefs (optional). Short context notes (PUT /v1/briefs/<slot>) that Envoy adds to a persona's instructions at the start of each chat: slot shared for 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 pathTokenWhat it does
POST /v1/pairnone (code)Redeem a pairing code. Body {"code","name"}. Returns agent_token once.
POST /v1/messagesagentBody {"text" (≤4000 chars), "reply_to"?, "from"?, "kind"?: "reply"|"notice", "ttl_seconds"? (60–86400)}.
PUT /v1/briefs/<slot>agentBody {"text"} (≤4 KB; empty text deletes). Slot: [a-z0-9_-]{1,32}. Kept 30 days.
DELETE /v1/briefs/<slot>agentRemove a brief.
GET /v1/agent · DELETE /v1/agentagentWho am I · unpair.
POST /v1/devicesnone(Envoy app) register a phone.
POST /v1/device/pairing-codedevice(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/ackdevice(Envoy app) fetch waiting messages; ack deletes them.
GET /v1/device/briefs · DELETE /v1/devicedevice(Envoy app) read briefs · delete everything for this phone.
GET /v1/healthnoneLiveness.

Errors are JSON {"error": "…"} with 400 / 401 / 404 / 409 / 413 / 429 (with retry_after_s).

Limits and retention

Security notes

Envoy Assistant · Privacy · Terms · support: hello@metarch.photography