ONE lead:reply
← Receivers

lead:reply

lead family

Sends a new lead the first reply from the caller's own workspace, at once: by text or WhatsApp when the lead ticked that box on the form (the consent record, never a field in the call) and the workspace has that channel connected, else one transactional email through message:send. A text goes through sms:send purpose form_reply in the fixed words that name the business and say Reply STOP to opt out; a WhatsApp message goes through channels as the approved template only (whatsappTemplate), never free text, and with none configured it is refused by name. WhatsApp first when both are ticked. Only one first reply leaves: when text or WhatsApp goes, no email does; anything refused there (no tick, no number, a STOP on either channel, no template, the one-reply-per-number-in-14-days and three-a-day-per-number caps) falls through to the email and is named in textRefused. The email is one transactional email through message:send, with the workspace's booking link when it has a bookable service, and records the seconds from the capture to the reply on the lead (meta.lead.firstReply) for the monthly report. One reply per address per workspace in 14 days (the reservation row rides agent_events_warm's 14-day purge); at most 100 first replies a UTC day per workspace and 3 a UTC day per address across every workspace — every bound keys on the inbox (lower-cased, +tag dropped, gmail dots folded); the email says a stranger can ignore it and carries an unsubscribe link signed for the inbox, so following it blocks every spelling; a canary lead, a suppressed or a declined address gets nothing and nothing is recorded

Effect
ask
Awaits an outcome — the call returns the response below.
Caller
manage_workflows
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
no
This cannot be undone. Dry-run it first where the contract allows.
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/lead:reply \
  -H "Authorization: Bearer $ONE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data": { "email": "sam@example.com", "personId": "p_123" }}'

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.

  • email string required The address the lead typed — the lead-follow-up path passes $trigger.email. It must be a plain addr-spec (no display name, angle brackets, quotes, lists or IP literal; broadcast/address.ts strictAddress), and the reply goes to that address as typed (domain lower-cased), while every bound, the stop link and consent key on its canonical form (lower-cased, +tag dropped, gmail dots folded). Anything else answers {ok:true, sent:false, reason:'no_email'}
  • personId string | null optional The lead's contact id from lead:capture ($trigger.personId). Used to read the capture time and the phone the form typed, and to write the minutes, and only when it is a contact of the caller's own workspace; otherwise the reply still goes by email, unrecorded
  • whatsappTemplate object optional The approved WhatsApp template for the first reply, set on the workspace's own lead:reply step (never from a lead's form). Its body in Meta must read '{{1}}: thanks for your enquiry. We'll reply here shortly. Reply STOP to opt out.' — the door fills {{1}} with the business name and takes no components from the caller. Absent or malformed: a WhatsApp first reply is refused by name (whatsapp_no_template) and the email goes

Response

What comes back from the call.

  • ok boolean
  • sent boolean true = the first reply left, by the channel named in channel
  • channel email | sms | whatsapp Which channel the first reply left on. Only one does: a text or WhatsApp reply sends no email
  • textRefused object[] The text or WhatsApp channels the lead agreed to and that refused, in the order tried, each with its reason. Absent when the lead agreed to neither
  • reason string Why nothing was sent, when ok is true and sent is false: no_email | already_replied | daily_cap (this workspace's 100 a day) | address_daily_cap (this inbox's 3 a day across every workspace) | cap_unreadable | canary (a readiness walk's test lead) | canary_unreadable | suppressed (the typed address or its inbox unsubscribed from this workspace) | suppression_unreadable | a message:send refusal
  • bookingUrl string | null The booking link the reply carried; null when the workspace has no active bookable service
  • seconds number | null Capture to reply; null when the capture time could not be read, and then nothing is recorded
  • minutes number | null
  • withinTarget boolean | null seconds <= 300, the five-minute speed-to-lead target
  • error string unauthenticated | no_db | send_failed (the send threw; nothing recorded, a later run may try again)

Traffic

Every call to lead:reply, 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 lead:reply, 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:218
  • one.ie/web/src/lib/reports/install.ts:55
Agent runtime 1
  • channels/src/channels/whatsapp-cloud.ts:206
Workflow 1
  • one.ie/web/src/lib/workflow-templates.ts:516
→

Answered by

lead:reply one.ie/web/src/lib/resolvers/lead-reply.ts:167 Dispatched through POST /api/ask/lead:reply, after the envelope validates the payload.
JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "email": {
      "type": "string",
      "description": "The address the lead typed — the lead-follow-up path passes $trigger.email. It must be a plain addr-spec (no display name, angle brackets, quotes, lists or IP literal; broadcast/address.ts strictAddress), and the reply goes to that address as typed (domain lower-cased), while every bound, the stop link and consent key on its canonical form (lower-cased, +tag dropped, gmail dots folded). Anything else answers {ok:true, sent:false, reason:'no_email'}"
    },
    "personId": {
      "description": "The lead's contact id from lead:capture ($trigger.personId). Used to read the capture time and the phone the form typed, and to write the minutes, and only when it is a contact of the caller's own workspace; otherwise the reply still goes by email, unrecorded",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "whatsappTemplate": {
      "description": "The approved WhatsApp template for the first reply, set on the workspace's own lead:reply step (never from a lead's form). Its body in Meta must read '{{1}}: thanks for your enquiry. We'll reply here shortly. Reply STOP to opt out.' — the door fills {{1}} with the business name and takes no components from the caller. Absent or malformed: a WhatsApp first reply is refused by name (whatsapp_no_template) and the email goes",
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "The approved template's name in the workspace's WhatsApp Business Account: lowercase letters, digits and underscores"
        },
        "language": {
          "type": "string",
          "description": "The template's language code, e.g. en or en_US"
        }
      },
      "required": [
        "name",
        "language"
      ]
    }
  },
  "required": [
    "email"
  ]
}
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "sent": {
      "description": "true = the first reply left, by the channel named in channel",
      "type": "boolean"
    },
    "channel": {
      "description": "Which channel the first reply left on. Only one does: a text or WhatsApp reply sends no email",
      "type": "string",
      "enum": [
        "email",
        "sms",
        "whatsapp"
      ]
    },
    "textRefused": {
      "description": "The text or WhatsApp channels the lead agreed to and that refused, in the order tried, each with its reason. Absent when the lead agreed to neither",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "channel": {
            "type": "string",
            "enum": [
              "sms",
              "whatsapp"
            ]
          },
          "reason": {
            "type": "string",
            "description": "consent_declined (a STOP on either channel) | consent_unreadable | whatsapp_no_template | whatsapp_not_connected | whatsapp_connection_unreadable | whatsapp_unreachable | whatsapp_graph_refused | whatsapp_graph_unreachable | whatsapp_declined | form_reply_unreadable | no_whatsapp_consent | already_replied (one reply per number per workspace in 14 days) | number_daily_cap (three a UTC day per number across every workspace) | cap_unreadable | sms_not_configured | sms_send_failed | a sms:send refusal"
          }
        },
        "required": [
          "channel",
          "reason"
        ]
      }
    },
    "reason": {
      "description": "Why nothing was sent, when ok is true and sent is false: no_email | already_replied | daily_cap (this workspace's 100 a day) | address_daily_cap (this inbox's 3 a day across every workspace) | cap_unreadable | canary (a readiness walk's test lead) | canary_unreadable | suppressed (the typed address or its inbox unsubscribed from this workspace) | suppression_unreadable | a message:send refusal",
      "type": "string"
    },
    "bookingUrl": {
      "description": "The booking link the reply carried; null when the workspace has no active bookable service",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "seconds": {
      "description": "Capture to reply; null when the capture time could not be read, and then nothing is recorded",
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ]
    },
    "minutes": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ]
    },
    "withinTarget": {
      "description": "seconds <= 300, the five-minute speed-to-lead target",
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ]
    },
    "error": {
      "description": "unauthenticated | no_db | send_failed (the send threw; nothing recorded, a later run may try again)",
      "type": "string"
    }
  },
  "required": [
    "ok"
  ]
}