ONE meta-msg:connect
← Receivers

meta-msg:connect

meta-msg family

Finish a Meta login: trade the code Meta sent back for a long-lived token, list the Pages and Instagram accounts it reaches, seal each token on its own channels connection (messenger: the Page id; instagram: the Instagram account id), and subscribe each account to the webhooks. Inbound for an account with no connection is refused, so this is what turns Meta messages on for a workspace. A state not signed for this workspace is refused. Instagram Login tokens last 60 days and are refreshed before expiresAt. The token is never echoed.

Effect
ask
Awaits an outcome — the call returns the response below.
Caller
owner
The class of authority the caller must already hold, decided from the attested context with no round trip.
Cost
free
What one call costs, so you can budget before acting.
Reversible
yes
The effect can be undone by a later call.
Idempotent
no
Not safe to blind-retry — dedupe on the envelope idempotencyKey.
Version
1.0.0
Pin this to keep a contract stable; additive bumps never break callers.

Send it with your agent

One click hands your coding agent a prompt that registers the substrate, reads this contract, and makes the call. Launch opens the app; the others copy the prompt.

Claude Code
Codex
Cursor
Gemini CLI
Claude Desktop
ChatGPT
curl -X POST https://one.ie/api/ask/meta-msg:connect \
  -H "Authorization: Bearer $ONE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data": { "workspace": <string>, "login": <facebook | instagram>, "code": <string>, "state": <string> }}'

The key is never in a link. npx -y @oneie/cli login writes it to ~/.config/oneie/key on your machine.

Request

Validated before dispatch — an invalid payload is refused with the fix, never half-applied.

  • workspace string required The workspace the signed state names
  • login facebook | instagram required The login meta-msg:connect-url started
  • code string required The code Meta put on the redirect. Single use
  • state string required The signed state meta-msg:connect-url put in the url, as Meta returned it

Response

What comes back from the call.

  • ok boolean
  • accounts object[] Every account connected by this login
  • expiresAt number Epoch ms the earliest token expires; refreshed before it
  • error string forbidden · bad_request · bad_state (not signed for this workspace, or stale) · state_person_mismatch (signed for another person) · state_used (a link works once) · no_db · code_rejected · no_accounts (the login reached no Page or Instagram account) · account_connected_elsewhere · graph_unreachable · connection_failed · meta_not_configured
  • cannot_run boolean
  • detail string

Traffic

Every call to meta-msg:connect, counted where it is dispatched — over HTTP or in-process alike. Aggregate only — no actor, no payload, no workspace.

Counting…

Wiring

Every place in the open source that names meta-msg:connect, and the file that answers it. Read from the tree at build time — a receiver is reached by NAME through one door, so there is no import edge to follow and a grep is the honest shape of the question. Structure, not volume — the count is in Traffic above.

Called from

API route 3
  • one.ie/web/src/lib/receiver-index.generated.ts:300
  • one.ie/web/src/lib/resolvers/meta.ts:67
  • one.ie/web/src/pages/api/integrations/meta/callback.ts:44
CLI 2
  • packages/cli/src/lib/receivers-index.generated.ts:307
  • packages/cli/src/lib/receivers.generated.ts:307
→

Answered by

meta-msg:connect one.ie/web/src/lib/resolvers/meta.ts:65 Dispatched through POST /api/ask/meta-msg:connect, after the envelope validates the payload.
JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "workspace": {
      "type": "string",
      "description": "The workspace the signed state names"
    },
    "login": {
      "type": "string",
      "enum": [
        "facebook",
        "instagram"
      ],
      "description": "The login meta-msg:connect-url started"
    },
    "code": {
      "type": "string",
      "description": "The code Meta put on the redirect. Single use"
    },
    "state": {
      "type": "string",
      "description": "The signed state meta-msg:connect-url put in the url, as Meta returned it"
    }
  },
  "required": [
    "workspace",
    "login",
    "code",
    "state"
  ]
}
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "accounts": {
      "description": "Every account connected by this login",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "network": {
            "type": "string",
            "enum": [
              "messenger",
              "instagram"
            ]
          },
          "id": {
            "type": "string",
            "description": "The Facebook Page id or the Instagram professional account id"
          },
          "name": {
            "type": "string"
          },
          "username": {
            "description": "Instagram handle, without @",
            "type": "string"
          }
        },
        "required": [
          "network",
          "id",
          "name"
        ]
      }
    },
    "expiresAt": {
      "description": "Epoch ms the earliest token expires; refreshed before it",
      "type": "number"
    },
    "error": {
      "description": "forbidden · bad_request · bad_state (not signed for this workspace, or stale) · state_person_mismatch (signed for another person) · state_used (a link works once) · no_db · code_rejected · no_accounts (the login reached no Page or Instagram account) · account_connected_elsewhere · graph_unreachable · connection_failed · meta_not_configured",
      "type": "string"
    },
    "cannot_run": {
      "type": "boolean"
    },
    "detail": {
      "type": "string"
    }
  },
  "required": [
    "ok"
  ]
}