Skip to main content

Template Syntax

Prompt templates use {{variable}} syntax to inject context data.
When triggered with:
Your agent receives:

Variable Rules

Case Sensitivity

Variable names are case-sensitive:
  • {{userName}}{{username}}{{UserName}}
Match the exact case used in your trigger call.

Missing Variables

If a variable isn’t provided in context:
  • The placeholder remains as-is: {{missing_var}}
  • Consider providing defaults or handling in your template

Special Characters

Context values are included as-is. Escape special characters if needed:
  • User input might contain quotes, HTML, etc.
  • Consider sanitizing sensitive data before passing

Template Examples

E-commerce

SaaS Onboarding

Error Recovery

Building Natural Messages

For events without custom templates, the system builds a natural message from context: Context:
Auto-generated message:
Custom templates are recommended for better agent responses.

User Data in Templates

Pass user information via the user option:
Access in templates:

Tips for Effective Templates

Don’t just say “user needs help” — describe the exact scenario:
  • What were they trying to do?
  • What went wrong or where did they get stuck?
  • What’s their current state?
Tell your agent how to help:
  • What solutions to offer
  • What tone to use
  • What to avoid saying
  • When to escalate
More context = better help:
  • User’s history with your product
  • Common issues at this point
  • Relevant policies or limitations
Use formatting to make templates easy to read:
  • Headers and sections
  • Bullet points for lists
  • Clear labels for data

Next Steps

Triggers

Fire triggers from your site via the widget

Widget Configuration

All widget options