This page describes features extending the AI Gateway, which provides a unified API for accessing multiple AI providers. To learn more, see AI Gateway.
{{variableName}} syntax for dynamic content injection.
Quick Start
"Hello John Smith, your Premium Plan subscription expires soon."
Configuration
| Parameter | Type | Required | Description | 
|---|---|---|---|
| inputs | object | No | Key-value pairs to replace {{key}}variables in messages | 
{{variableName}} (case-sensitive, alphanumeric + underscore)
Use Cases
| Scenario | Variables | Example Input | 
|---|---|---|
| Customer Support | {{customer_name}},{{issue_type}} | {customer_name: "Alice", issue_type: "billing"} | 
| Product Recommendations | {{user_preferences}},{{budget}} | {user_preferences: "eco-friendly", budget: "$500"} | 
| Onboarding | {{user_name}},{{plan_type}} | {user_name: "Bob", plan_type: "Enterprise"} | 
| Content Generation | {{topic}},{{audience}} | {topic: "AI trends", audience: "developers"} | 
Implementation Examples
Customer Support Automation
Personalized Email Generation
Multi-Language Support
Advanced Patterns
Dynamic Template Loading
Conditional Content Generation
Batch Input Processing
Input Validation
Type Safety with TypeScript
Runtime Validation
Error Handling
Template Variable Detection
Safe Input Substitution
Performance Optimization
Input Caching
Template Compilation
Best Practices
- Variable Naming: Use descriptive, snake_case variable names
- Input Validation: Always validate inputs before sending requests
- Template Testing: Test templates with sample data before production
- Security: Sanitize user inputs to prevent injection attacks
- Performance: Cache frequently used input combinations
- Documentation: Document required inputs for each template
Troubleshooting
**Variables not replaced- Cause: Typo in variable name or syntax
- Solution: Check {{variableName}}format matches input keys
- Cause: Required inputs not provided
- Solution: Validate all template variables have corresponding inputs
- Cause: HTML/special characters in inputs
- Solution: Sanitize inputs before sending
- Cause: Large input objects
- Solution: Limit input size and cache frequently used values
Limitations
| Limitation | Description | Workaround | 
|---|---|---|
| Variable Syntax | Only {{variableName}}format supported | Use consistent naming convention | 
| Nested Objects | No support for {{user.name}}syntax | Flatten object structure | 
| Input Size | Large inputs increase token usage | Keep inputs concise and relevant | 
| Special Characters | Some characters may need escaping | Sanitize inputs appropriately | 
| Case Sensitivity | Variable names are case-sensitive | Use consistent casing throughout |