Sales Agent
The Sales Agent turns your chatbot into a lead-capture assistant. It detects when a conversation has sales intent, collects configurable lead fields from the user, and delivers captured leads through one or more delivery channels (email or webhook).
Overview
The Sales Agent has two independent controls:
- Configuration — the prompt overlay, lead fields to collect, model override, guardrails, and trigger sensitivity. Configured via the dashboard or the Management API.
- Enablement — whether the agent is live at runtime (
salesAgentEnabled). Configuring the agent does not automatically enable it; enablement is a separate control.
Configuring the Sales Agent
Via the dashboard
Open the chatbot dashboard, then go to Agents → Sales Agent.
The Sales Agent detail view contains Overview, Configure, Hand-offs, Leads, and Analytics sections. Use the Enable/Pause control in the Sales Agent header to change the runtime salesAgentEnabled state.
Via the Management API
Get current configuration
GET /api/v1/chatbots/{chatbotId}/sales-agent
Required scope: chatbots:read
Returns the public Sales Agent configuration plus salesAgentEnabled — whether the agent is live at runtime. When no Sales Agent configuration document exists yet, the response contains only the runtime enablement flag.
Update configuration
PATCH /api/v1/chatbots/{chatbotId}/sales-agent
Required scope: chatbots:write
Creates the Sales Agent document on first update (the response includes created: true when that happens). Only the fields you send are applied; omitted fields are unchanged.
Common writable configuration fields include:
| Field | Type | Description |
|---|---|---|
enabled | boolean | Enable or disable this Sales Agent configuration. This is not the runtime live/paused switch; runtime enablement is salesAgentEnabled. |
promptOverlay | string | Custom prompt text that overlays the base agent persona. |
promptSlots | object | Structured prompt fields such as persona, value propositions, qualifying questions, and forbidden topics. |
promptEditorMode | string | Prompt editor mode: free-form or structured. |
modelOverride | string | null | Override the model in model@provider form, or null to clear. |
componentModels | object | null | Per-component model overrides. |
fieldsToCapture | array | Lead fields the agent should collect from the user. |
guardrailEnabled | boolean | Enable the built-in sales guardrail rules. |
guardrailRules | array | Built-in guardrail rule IDs. |
guardrailCustomRules | array | Custom guardrail rules. |
triggerCategories | array | Sales-intent categories that can trigger the agent. |
triggerCustomRules | array | Custom trigger rules. |
triggerExclusions | array | Situations that should not trigger the Sales Agent. |
triggerSensitivity | string | How aggressively the agent triggers on sales intent. |
scopeOverrides | object | Per-knowledge-scope overrides for supported prompt, capture, guardrail, and trigger fields. |
evalEnabled | boolean | Enable Sales Agent quality-evaluation calls. |
Use PATCH /api/v1/chatbots/{chatbotId}/apply to update chatbot-level runtime configuration such as salesAgentEnabled through the config-as-code surface.
Lead Delivery Channels (Handoffs)
Captured leads are delivered through handoff channels. Each channel sends lead data to a configured recipient via email (smtp or resend) or webhook.
A channel can only be created from the dashboard — creating one is inseparable from storing its sending secret (email credentials or webhook HMAC). Once a channel exists, its routing and recipient settings can be managed via the API.
Listing channels
GET /api/v1/chatbots/{chatbotId}/sales-agent/handoffs
Required scope: chatbots:read
Returns all handoff channels. Each channel includes:
channel— delivery type:smtp,resend, orwebhookroutingMode— how recipients are selected:single,distribution,country, orscopehasSecret/hasWebhookHmac— whether a sending secret is configured (the secret itself is never returned)enabled— whether the channel is active
Updating a channel
PATCH /api/v1/chatbots/{chatbotId}/sales-agent/handoffs/{handoffId}
Required scope: chatbots:write
Writable fields:
| Field | Type | Description |
|---|---|---|
enabled | boolean | Activate or deactivate the channel. Enabling requires a secret to already be configured. |
routingMode | string | single | distribution | country | scope |
routingConfig | object | Routing-mode-specific recipient configuration. |
verifiedSender | string | Verified sender email address (email channels). |
webhookUrl | string | Webhook endpoint URL (webhook channels). |
fieldsToInclude | array | Which captured lead fields to include in the delivery payload. |
templateVersionId | string | Email template version to use. |
Deleting a channel
DELETE /api/v1/chatbots/{chatbotId}/sales-agent/handoffs/{handoffId}
Required scope: chatbots:write
Idempotent — deleting an unknown channel ID still returns success.
Viewing Captured Leads
GET /api/v1/chatbots/{chatbotId}/sales-agent/leads
Required scope: analytics:read (owner/admin only)
Returns captured lead metadata — disposition, handoff status, country code, timestamps, and aggregates — without exposing PII. See the API reference for the full response schema.
Viewing a Single Lead (with PII)
GET /api/v1/chatbots/{chatbotId}/sales-agent/leads/{leadId}
Required scope: security:read (owner/admin only)
Returns the same metadata as the list plus the decrypted contact PII (name, email, phone, company, any custom fields) and coarse geo detail (region, city, timezone). This path is audit-logged. A decryptError field is present if server-side decryption failed; the raw encrypted envelope and HMAC hashes are never returned.
Returns 404 for a missing, soft-deleted, or unauthorized lead (IDOR-safe).
Exporting Leads as CSV
GET /api/v1/chatbots/{chatbotId}/sales-agent/leads/export
Required scope: security:read (owner/admin only)
Returns a CSV with decrypted contact fields (name, email, phone, company) and coarse geo columns. Each row includes a pii_decrypt_status column (ok / failed / erased / none). Cells are hardened against CSV injection. The export is capped at 5,000 rows — narrow the time window or filters if you receive a 413 response.
GDPR DSAR Lead Erasure
POST /api/v1/chatbots/{chatbotId}/sales-agent/leads/{leadId}/dsar-erase
Required scope: security:write (owner/admin only)
Hard-erases a single lead's PII: scrubs the encrypted contact fields, HMAC hashes, and PII-adjacent geo (IP, region, city, timezone) while retaining the anonymous row (disposition, capturedAt, country code) so aggregate metrics remain intact. Idempotent — repeating the request on an already-erased lead returns 409 and preserves the original piiErasedAt timestamp (GDPR Article 17 audit-trail integrity).
Related
- Management API Reference — Get Sales Agent
- Management API Reference — Update Sales Agent
- Management API Reference — List Handoffs
- Management API Reference — Update Handoff
- Management API Reference — Delete Handoff
- Management API Reference — List Leads
- Management API Reference — Get Lead (with PII)
- Management API Reference — Export Leads CSV
- Management API Reference — DSAR Erase Lead