ONE analytics:run
← Receivers

analytics:run

analytics family

The caller's own performance report as finished email text — new leads, bookings, sales and time to first reply over the last calendar month or the last seven days, addressed to the workspace owner. A figure that could not be read says so, never 0

Effect
ask
Awaits an outcome — the call returns the response below.
Caller
manage_workspace
The class of authority the caller must already hold, decided from the attested context with no round trip.
Authority action
read_revenue
Also gated per node — the caller must be permitted this action over the workspace it names.
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/analytics:run \
  -H "Authorization: Bearer $ONE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data": { "cadence": "month" }}'

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.

  • cadence month | week required month = the whole previous calendar month (UTC); week = the seven days up to now

Response

What comes back from the call.

  • ok boolean
  • workspace string Always the attested caller's workspace
  • cadence month | week
  • window object The window read, from inclusive, to exclusive
  • to string The workspace owner's email: owners.recovery_email, else the human role-'owner' actor world:create-workspace recorded on this workspace. Never a caller field, never a contact
  • subject string
  • text string The report body, ready for message:send
  • facts object null = could not be read, never zero
  • error string no_db | unauthenticated | bad_request | forbidden | no_recipient (the workspace has no owner email) | recipient_unreadable

Traffic

Every call to analytics:run, 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 analytics:run, 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:43
  • one.ie/web/src/lib/reports/report.ts:3
Workflow 1
  • one.ie/web/src/lib/workflow-templates.ts:1890
→

Answered by

analytics:run one.ie/web/src/lib/resolvers/analytics.ts:151 Dispatched through POST /api/ask/analytics:run, after the envelope validates the payload.

analytics family · 2 more

JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "cadence": {
      "type": "string",
      "enum": [
        "month",
        "week"
      ],
      "description": "month = the whole previous calendar month (UTC); week = the seven days up to now"
    }
  },
  "required": [
    "cadence"
  ]
}
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "workspace": {
      "description": "Always the attested caller's workspace",
      "type": "string"
    },
    "cadence": {
      "type": "string",
      "enum": [
        "month",
        "week"
      ]
    },
    "window": {
      "description": "The window read, from inclusive, to exclusive",
      "type": "object",
      "properties": {
        "fromMs": {
          "type": "number"
        },
        "toMs": {
          "type": "number"
        },
        "label": {
          "type": "string"
        }
      },
      "required": [
        "fromMs",
        "toMs",
        "label"
      ]
    },
    "to": {
      "description": "The workspace owner's email: owners.recovery_email, else the human role-'owner' actor world:create-workspace recorded on this workspace. Never a caller field, never a contact",
      "type": "string"
    },
    "subject": {
      "type": "string"
    },
    "text": {
      "description": "The report body, ready for message:send",
      "type": "string"
    },
    "facts": {
      "description": "null = could not be read, never zero",
      "type": "object",
      "properties": {
        "leads": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "bookings": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "sales": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "count": {
                  "type": "number"
                },
                "byCurrency": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "number"
                  }
                }
              },
              "required": [
                "count",
                "byCurrency"
              ]
            },
            {
              "type": "null"
            }
          ],
          "description": "Paid orders; minor units per currency, never summed across currencies"
        },
        "firstReplyMinutes": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "description": "null until the follow-up engine records first-touch minutes"
        }
      },
      "required": [
        "leads",
        "bookings",
        "sales",
        "firstReplyMinutes"
      ]
    },
    "error": {
      "description": "no_db | unauthenticated | bad_request | forbidden | no_recipient (the workspace has no owner email) | recipient_unreadable",
      "type": "string"
    }
  },
  "required": [
    "ok"
  ]
}