ONE broadcast:ab-set
← Receivers

broadcast:ab-set

broadcast family

Put an A/B subject test on a draft or scheduled email broadcast, or take it off (off: true). 2 to 4 variants, a test slice (5 to 50 percent, default 20), a metric (open, click or revenue; default click), a wait (1 to 72 hours, default 4) and a minimum event count before a winner is called; the rest get the winner. Refused when an optimised send time is set: the two do not combine

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
yes
Safe to retry as-is.

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/broadcast:ab-set \
  -H "Authorization: Bearer $ONE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data": { "broadcastId": <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 optional Your group; naming one you do not run is refused forbidden
  • broadcastId string required
  • off boolean optional true takes the test off
  • variants object[] optional 2 to 4 variants, keyed A, B, C, D in order
  • test_pct number optional Integer 5 to 50; default 20
  • metric string optional open · click · revenue; default click
  • wait_hours number optional Integer 1 to 72; default 4
  • min_events number optional Integer 1 to 10000: events the leader needs before it wins on the metric; default 5

Response

What comes back from the call.

  • ok boolean
  • broadcastId string
  • ab object | null null = the test was taken off
  • preheader_rendered boolean
  • refused string no_db · forbidden · not_found · not_editable (only draft or scheduled) · email_only · optimised_send_time_set · invalid · body_ref_not_found
  • detail string

Traffic

Every call to broadcast:ab-set, 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 broadcast:ab-set, 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

UI 1
  • one.ie/web/src/components/newsletter/SendSmarter.tsx:123
API route 2
  • one.ie/web/src/lib/receiver-index.generated.ts:88
  • one.ie/web/src/lib/resolvers/broadcast-smart.ts:42
CLI 2
  • packages/cli/src/lib/receivers-index.generated.ts:86
  • packages/cli/src/lib/receivers.generated.ts:86
→

Answered by

broadcast:ab-set one.ie/web/src/lib/resolvers/broadcast-smart.ts:41 Dispatched through POST /api/ask/broadcast:ab-set, after the envelope validates the payload.
JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "workspace": {
      "description": "Your group; naming one you do not run is refused forbidden",
      "type": "string"
    },
    "broadcastId": {
      "type": "string"
    },
    "off": {
      "description": "true takes the test off",
      "type": "boolean"
    },
    "variants": {
      "description": "2 to 4 variants, keyed A, B, C, D in order",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "subject": {
            "type": "string",
            "description": "1 to 300 characters"
          },
          "preheader": {
            "description": "Stored per variant; not drawn in the email yet (preheader_rendered:false)",
            "type": "string"
          },
          "body_ref": {
            "description": "Another broadcast of yours whose body this variant sends",
            "type": "string"
          }
        },
        "required": [
          "subject"
        ]
      }
    },
    "test_pct": {
      "description": "Integer 5 to 50; default 20",
      "type": "number"
    },
    "metric": {
      "description": "open · click · revenue; default click",
      "type": "string"
    },
    "wait_hours": {
      "description": "Integer 1 to 72; default 4",
      "type": "number"
    },
    "min_events": {
      "description": "Integer 1 to 10000: events the leader needs before it wins on the metric; default 5",
      "type": "number"
    }
  },
  "required": [
    "broadcastId"
  ]
}
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "broadcastId": {
      "type": "string"
    },
    "ab": {
      "description": "null = the test was taken off",
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "variants": {
              "type": "array",
              "items": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              }
            },
            "test_pct": {
              "type": "number"
            },
            "metric": {
              "type": "string"
            },
            "wait_hours": {
              "type": "number"
            },
            "min_events": {
              "type": "number"
            }
          },
          "required": [
            "variants",
            "test_pct",
            "metric",
            "wait_hours",
            "min_events"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "preheader_rendered": {
      "type": "boolean"
    },
    "refused": {
      "description": "no_db · forbidden · not_found · not_editable (only draft or scheduled) · email_only · optimised_send_time_set · invalid · body_ref_not_found",
      "type": "string"
    },
    "detail": {
      "type": "string"
    }
  },
  "required": [
    "ok"
  ]
}