{% if language == "de" %}Guten Tag! Sie arbeiten für {{ company_name }}.{% endif %}{% if account_tier == "premium" %}Priority support available.{% endif %}
You are speaking with {{ contact.first_name }} {{ contact.last_name }}.Their email is {{ contact.email | default("not provided") }}.Their phone number is {{ contact.phone }}.
Custom fields are NOT nested under contact. — they’re top-level variables like {{ language }} or {{ account_tier }}. You must provide these through your Dynamic Context API.
Any custom data you provide through your Dynamic Context API endpoint becomes available as top-level variables:
Copy
{{ account_tier }}{{ language }}{{ company_name }}{{ preferred_contact_method }}
Example with custom variables:
Copy
{% if account_tier == "premium" %}As a premium customer, you have priority support.{% endif %}{% if language == "de" %}Sprechen Sie Deutsch.{% endif %}Company: {{ company_name | default("valued customer") }}
Set up a Dynamic Context API endpoint to provide custom variables. Any JSON fields you return become top-level variables (e.g., {"language": "de"} → {{ language }}).
Use current_datetime to build advanced time-based logic like business hours routing, time-of-day greetings, or scheduling constraints without needing external data sources.
Use the datetime filter for formatting. The .strftime() method is not available due to security restrictions.
{% if language == "es" %}Respond in Spanish. Use formal addressing (usted).{% elif language == "fr" %}Respond in French. Use formal addressing (vous).{% elif language == "de" %}Respond in German. Use formal addressing (Sie).{% else %}Respond in English. Use friendly, conversational tone.{% endif %}
{% if contact.first_name %}Hello {{ contact.first_name }}, great to hear from you!{% else %}Hello! Thanks for calling!{% endif %}{% if contact.email %}I have your contact information on file, so I can send you a confirmation after our call.{% endif %}
Example 2: Custom Business Logic (Requires Dynamic Context API)
Copy
{% if contact.first_name %}Hello {{ contact.first_name }}, thanks for calling {{ company_name }}!{% else %}Hello! Thanks for calling {{ company_name }}!{% endif %}{% if account_tier == "premium" %}As a premium customer, you have priority support. How can I help you today?{% else %}How can I help you today?{% endif %}
Variables like company_name and account_tier must be provided by your Dynamic Context API endpoint.
Current time: {{ current_datetime | datetime("%H:%M") }}{% if current_datetime.hour >= 17 or current_datetime.hour < 9 %}Outside normal business hours. If customer needs immediate assistance:"Our regular support hours are 9 AM to 5 PM. For urgent issues, I can take your information and have someone call you first thing in the morning, or you can reach our emergency line at [number]."{% else %}Within business hours. Full support available.{% endif %}