Hosted Mode
Hosted mode is the easiest way to ship something useful.
You provide the prompt. Saperly handles the call loop.
compliance_enabled: true on the line. With the flag off, TCPA, GDPR, and local telecom compliance are the customer’s responsibility. See Compliance and Consent for the full liability framing and how to opt in.When to use it
Use hosted mode if:
- you want to launch quickly
- your call logic is mostly prompt-driven
- you do not want to run a webhook server yet
- you want a receptionist, intake agent, reminder bot, or FAQ line
Create a hosted line
mode does not yet include hosted. Cast to another allowed value as shown, or call the API directly with curl or Python until the SDK ships the updated type.Important fields
system_prompt
This is the core behavior contract for the line.
Be specific. Tell the agent:
- who it is
- what it can help with
- what it must never do
- when it should escalate or stop
begin_message
Use this to avoid dead air at the start of the call.
If you leave it out, the line waits for the caller to speak first.
voice
Use GET /api/v1/voices to list available voice IDs before you pick one.
context_limit
Higher values preserve more conversation history but use more tokens and may slow longer calls.
Prompt engineering examples
The quality of your system_prompt (or topic for one-off calls) decides how the line behaves. Two concrete patterns to start from:
Receptionist
Appointment reminder (one-off conversation call)
One-off conversation calls
If the prompt changes per call, use the conversation call endpoint instead of creating a new line every time.
Good first hosted-mode use cases
- front desk and receptionist
- FAQ line
- appointment reminders
- after-hours triage
- simple order status assistant
When not to use hosted mode
Do not start here if your call needs:
- deep internal business logic
- privileged backend actions
- strict deterministic flow control
- your own model runtime
In those cases, use Webhook Mode or Audio Mode.
Testing your hosted line
Once the line is created, walk through the full loop end to end before you put it in front of real callers.
Verify the greeting
You should hear begin_message spoken aloud in the voice you selected. If there is silence, the line is likely waiting for you to speak first because begin_message was not set.
Have a short conversation
Ask 2-3 questions your system_prompt covers. Listen for on-topic answers and for the refusal behavior you defined (for example, the emergency handoff in the dental example).
GET /api/v1/voices), (3) your balance is sufficient.Call recording
Enable recording per line:
Retrieve the recording URL from the call object after the call ends:
The response includes recording_url and transcript fields when recording is enabled.
Inbound SMS
Hosted mode bundles ConvAI for voice. Voice mode does not gate SMS.
Every line — hosted, webhook, or audio — receives inbound SMS. Saperly records the consent record and logs a sms_received compliance event regardless of voice mode.
To auto-reply, set webhookUrl on the line. Your server receives the sms_received event and replies by calling POST /api/v1/messages with text generated by your own LLM:
A hosted line without webhookUrl still records consent and the compliance event on inbound SMS, but Saperly will not deliver the event to a customer endpoint and your code has nothing to reply with. See SMS and Conversations for the reply API and 24-hour conversation window.
