Build your integration / Try a draft in a test conversation
GUIDE

Try a draft in a test conversation

Try a draft prompt before you save it. You can see the agent's next reply, whether it would ask your team to take over, and whether a booking would succeed in the simulation. The test creates no contacts, messages or appointments and sends no alerts.

Try a reply

  1. Use an API key with the agents:test permission. For SMS, get the agent ID from List SMS agents.
  2. Send a message a lead might write. Add agentInstructions to try a draft, or omit it to test the saved instructions.
  3. To continue the same test, send the returned conversationHistory and bookingPreviewState with the next message. Include your draft again on each turn.
curl -X POST https://pub-api.leadtruffle.com/api/v2/pub/test-conversations \
  -H "X-API-Key: $LEADTRUFFLE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "channel": "sms_agent",
    "agentId": "48aef8c7-725b-46a7-991e-ca81f6fd6261",
    "message": "Can you replace a leaking water heater this week?",
    "agentInstructions": "Ask for the ZIP code before discussing appointment times."
  }'

Choose what to test

  • SMS and webchat accept a draft prompt and an optional mock name, email or phone. An SMS draft is tested as freeform instructions. SMS also accepts a draft escalationPolicy. Set enabled to true to try its criteria.
  • Missed call uses the saved prompt. You can pass a mock phone or voicemailTranscript under mockLead.
  • Yelp, Thumbtack and Facebook Messenger accept a draft prompt. Thumbtack and Messenger accept a mock name. For Messenger, provide pageId if more than one connected page has Messenger enabled.

If escalation.wouldEscalate is true, inspect reason and summary. A null reply means the agent would stay quiet. A booking result of SIMULATED means the preview accepted an exact slot. Third-party calendars use fictional times, and a LeadTruffle calendar preview can use existing availability.

History keeps up to 12 recent messages. Each new message can be up to 2,000 characters. If the API returns 429, wait the number of seconds in Retry-After.

When you're happy with a draft, save it separately. See Manage AI agents for SMS settings and Run a test conversation turn for the full REST contract.

Guides & API endpoints Esc to close