ONE meta-msg:stats
← Receivers

meta-msg:stats

meta-msg family

mcp

The comment-to-DM funnel for a workspace: comments → matched by a rule → DM sent → replied (people, not messages) → contact → lead → sale, with expired and refused (by reason) beside it and the paid revenue from the order ledger, in total and by rule, post, ad or day. Read from the meta.* tracked events, which are kept 14 days: a window reaching further back is moved up to the oldest kept day and answers `clamped`. A list cut short says so (capped, total).

Effect
ask
Awaits an outcome — the call returns the response below.
Caller
manage_integrations
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
yes
Safe to retry as-is.
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:stats \
  -H "Authorization: Bearer $ONE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data": { "workspace": "brightdental", "by": "rule" }}'

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 to read
  • since number optional Epoch ms the window starts; default 14 days back, all the events keep. An earlier since is moved up to the oldest kept day and the answer carries `clamped` (with the since that was asked). Echoed as used
  • until number optional Epoch ms the window ends; default now. Echoed
  • by rule | post | ad | day optional Split the funnel into rows; omit for the total only

Response

What comes back from the call.

  • ok boolean
  • since number
  • until number
  • by rule | post | ad | day
  • funnel object The whole window
  • rows object[] One row per rule, post, ad or day when `by` is given ('none' for events with no such id); busiest first, days in order
  • capped boolean true: rows were cut at the limit (100); total says how many there are
  • total number How many rows exist before the cap
  • clamped object Present when the window reached past the kept events: `since` was moved up to the oldest kept day, so the answer is short
  • refusedByReason object Refusals by their named reason (window_closed, opted_out, rate_limited, …); they sum to funnel.refused
  • revenue object[] Paid orders marked live (test_mode = 0) behind meta.purchase events, per currency, never summed across currencies
  • unmarkedOrders number Paid orders behind meta.purchase with no live/test mark: never counted as revenue, counted here so the gap shows
  • error string forbidden · bad_request · no_db · stats_unavailable (the read failed; nothing is guessed)

Traffic

Every call to meta-msg:stats, 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:stats, 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 2
  • one.ie/web/src/lib/receiver-index.generated.ts:299
  • one.ie/web/src/lib/resolvers/meta-stats.ts:16
CLI 1
  • packages/cli/src/meta.ts:429
→

Answered by

meta-msg:stats Resolved outside this repo — the pay, channels or api worker answers it. Dispatched through POST /api/ask/meta-msg:stats, 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 to read"
    },
    "since": {
      "description": "Epoch ms the window starts; default 14 days back, all the events keep. An earlier since is moved up to the oldest kept day and the answer carries `clamped` (with the since that was asked). Echoed as used",
      "type": "number"
    },
    "until": {
      "description": "Epoch ms the window ends; default now. Echoed",
      "type": "number"
    },
    "by": {
      "description": "Split the funnel into rows; omit for the total only",
      "type": "string",
      "enum": [
        "rule",
        "post",
        "ad",
        "day"
      ]
    }
  },
  "required": [
    "workspace"
  ]
}
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "since": {
      "type": "number"
    },
    "until": {
      "type": "number"
    },
    "by": {
      "type": "string",
      "enum": [
        "rule",
        "post",
        "ad",
        "day"
      ]
    },
    "funnel": {
      "description": "The whole window",
      "type": "object",
      "properties": {
        "comments": {
          "type": "number"
        },
        "matched": {
          "type": "number"
        },
        "dmSent": {
          "type": "number"
        },
        "replied": {
          "type": "number"
        },
        "contacts": {
          "type": "number"
        },
        "leads": {
          "type": "number"
        },
        "sales": {
          "type": "number"
        },
        "expired": {
          "type": "number",
          "description": "Private replies dropped at the 7-day deadline"
        },
        "refused": {
          "type": "number",
          "description": "Sends refused by name (window_closed, opted_out, rate_limited, …)"
        }
      },
      "required": [
        "comments",
        "matched",
        "dmSent",
        "replied",
        "contacts",
        "leads",
        "sales",
        "expired",
        "refused"
      ]
    },
    "rows": {
      "description": "One row per rule, post, ad or day when `by` is given ('none' for events with no such id); busiest first, days in order",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "The rule id, post id, ad id or day (YYYY-MM-DD)"
          },
          "label": {
            "type": "string"
          },
          "comments": {
            "type": "number"
          },
          "matched": {
            "type": "number"
          },
          "dmSent": {
            "type": "number"
          },
          "replied": {
            "type": "number"
          },
          "contacts": {
            "type": "number"
          },
          "leads": {
            "type": "number"
          },
          "sales": {
            "type": "number"
          },
          "expired": {
            "type": "number"
          },
          "refused": {
            "type": "number"
          },
          "revenueCents": {
            "type": "number",
            "description": "Paid, non-test usd cents from the ledger for this row's meta.purchase orders; other currencies are only in `revenue`"
          }
        },
        "required": [
          "key",
          "comments",
          "matched",
          "dmSent",
          "replied",
          "contacts",
          "leads",
          "sales",
          "expired",
          "refused",
          "revenueCents"
        ]
      }
    },
    "capped": {
      "description": "true: rows were cut at the limit (100); total says how many there are",
      "type": "boolean"
    },
    "total": {
      "description": "How many rows exist before the cap",
      "type": "number"
    },
    "clamped": {
      "description": "Present when the window reached past the kept events: `since` was moved up to the oldest kept day, so the answer is short",
      "type": "object",
      "properties": {
        "reason": {
          "type": "string",
          "const": "retention"
        },
        "retentionDays": {
          "type": "number",
          "description": "How many days the events are kept (14)"
        },
        "askedSince": {
          "type": "number",
          "description": "The since that was asked, before it was moved up"
        }
      },
      "required": [
        "reason",
        "retentionDays",
        "askedSince"
      ]
    },
    "refusedByReason": {
      "description": "Refusals by their named reason (window_closed, opted_out, rate_limited, …); they sum to funnel.refused",
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {
        "type": "number"
      }
    },
    "revenue": {
      "description": "Paid orders marked live (test_mode = 0) behind meta.purchase events, per currency, never summed across currencies",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string",
            "description": "Lower-case ISO code"
          },
          "cents": {
            "type": "number"
          },
          "orders": {
            "type": "number"
          }
        },
        "required": [
          "currency",
          "cents",
          "orders"
        ]
      }
    },
    "unmarkedOrders": {
      "description": "Paid orders behind meta.purchase with no live/test mark: never counted as revenue, counted here so the gap shows",
      "type": "number"
    },
    "error": {
      "description": "forbidden · bad_request · no_db · stats_unavailable (the read failed; nothing is guessed)",
      "type": "string"
    }
  },
  "required": [
    "ok"
  ]
}