← Receivers

crm:advertise

crm family

Add one person to an ad campaign's targeting — refused without their ads consent (opt-in: no record is no), then the campaign's persona/region tags land on them and the campaign:targeting count is read back. Without a campaign, answers the sheet: campaigns, consent, Meta connection

Effect
ask
Awaits an outcome — the call returns the response below.
Caller
manage_lifecycle
The class of authority the caller must already hold, decided from the attested context with no round trip.
Authority action
manage_lifecycle
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/crm:advertise \
  -H "Authorization: Bearer $ONE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data": { "actorId": "ada" }}'

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.

  • actorId string required The person's actor uid (with or without the `actor:` prefix). Their consent is read from their own row in this group, `actor:<uid>`; a grant filed under their email does not count.
  • campaign string optional Ad campaign gid in the caller's attested group. Omit to read the sheet instead of writing.
  • workspace string optional Lets a verified SERVICE caller (channels chat) name the group: /api/ask promotes it to the attested group for that caller class only. A session or world-key caller's value is ignored — the group is always the attested one, so the consent read and the tag write can never land in two different groups.

Response

What comes back from the call.

  • ok boolean
  • consent granted | required | declined | … The person's ads consent. Only `granted` lets them be added; `unreadable` refuses (the gate fails closed)
  • campaigns object[] Sheet mode: the group's ad campaigns, newest first, at most 50, and the persona/region tags each would put on a person
  • truncated boolean Sheet mode: true when the group has more than 50 ad campaigns and this list is cut
  • meta object Sheet mode: the Composio FACEBOOK connection for this group. `unknown` = could not check, never 'not connected'
  • added object
  • campaign string
  • workspace string Sheet mode: the attested group the answer is about — the group whose campaigns, consent and Meta connection these are
  • error string consent_required | consent_declined | consent_suppressed | consent_unreadable | campaign_not_found | campaign_has_no_targeting | campaigns_unreadable | write_failed | write_not_read_back | bad_request | no_db | forbidden

Traffic

Every call to crm:advertise, 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 crm:advertise, 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/crm/AdvertiseSheet.tsx:10
API route 3
  • one.ie/web/src/lib/ads-gates.ts:21
  • one.ie/web/src/lib/crm/advertise.ts:136
  • one.ie/web/src/lib/receiver-index.generated.ts:109
→

Answered by

crm:advertise one.ie/web/src/lib/resolvers/crm.ts:72 Dispatched through POST /api/ask/crm:advertise, after the envelope validates the payload.

crm family · 2 more

JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "actorId": {
      "type": "string",
      "description": "The person's actor uid (with or without the `actor:` prefix). Their consent is read from their own row in this group, `actor:<uid>`; a grant filed under their email does not count."
    },
    "campaign": {
      "description": "Ad campaign gid in the caller's attested group. Omit to read the sheet instead of writing.",
      "type": "string"
    },
    "workspace": {
      "description": "Lets a verified SERVICE caller (channels chat) name the group: /api/ask promotes it to the attested group for that caller class only. A session or world-key caller's value is ignored — the group is always the attested one, so the consent read and the tag write can never land in two different groups.",
      "type": "string"
    }
  },
  "required": [
    "actorId"
  ]
}
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "consent": {
      "description": "The person's ads consent. Only `granted` lets them be added; `unreadable` refuses (the gate fails closed)",
      "type": "string",
      "enum": [
        "granted",
        "required",
        "declined",
        "suppressed",
        "unreadable"
      ]
    },
    "campaigns": {
      "description": "Sheet mode: the group's ad campaigns, newest first, at most 50, and the persona/region tags each would put on a person",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "gid": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "targeting": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "gid",
          "name",
          "targeting"
        ]
      }
    },
    "truncated": {
      "description": "Sheet mode: true when the group has more than 50 ad campaigns and this list is cut",
      "type": "boolean"
    },
    "meta": {
      "description": "Sheet mode: the Composio FACEBOOK connection for this group. `unknown` = could not check, never 'not connected'",
      "type": "object",
      "properties": {
        "state": {
          "type": "string",
          "enum": [
            "connected",
            "not_connected",
            "unknown"
          ]
        },
        "connectUrl": {
          "type": "string"
        }
      },
      "required": [
        "state",
        "connectUrl"
      ]
    },
    "added": {
      "type": "object",
      "properties": {
        "campaign": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "tags": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The targeting tags written on the person"
        },
        "holds": {
          "type": "boolean",
          "description": "The person's row was read back and carries every tag"
        },
        "audienceBefore": {
          "type": "number",
          "description": "campaign:targeting audienceSize before the write (an OR over the tags — an upper bound)"
        },
        "audienceAfter": {
          "type": "number",
          "description": "The same count after; it moves by one unless the person already held a tag"
        }
      },
      "required": [
        "campaign",
        "name",
        "tags",
        "holds",
        "audienceBefore",
        "audienceAfter"
      ]
    },
    "campaign": {
      "type": "string"
    },
    "workspace": {
      "description": "Sheet mode: the attested group the answer is about — the group whose campaigns, consent and Meta connection these are",
      "type": "string"
    },
    "error": {
      "description": "consent_required | consent_declined | consent_suppressed | consent_unreadable | campaign_not_found | campaign_has_no_targeting | campaigns_unreadable | write_failed | write_not_read_back | bad_request | no_db | forbidden",
      "type": "string"
    }
  },
  "required": [
    "ok"
  ]
}