We are migrating our transactional templates off SendGrid to AutoSend. How do SendGrid {{#if substitution}} tags map to AutoSend Handlebars syntax, and how are JSON parameters passed via API?
Variable Syntax Comparison: SendGrid vs AutoSend
Both SendGrid and AutoSend evaluate transactional templates using standard Handlebars syntax, making template migration straightforward.
Variable Interpolation & Key Casing
- Campaigns & Automations (Marketing): AutoSend uses camelCase by default for built-in contact profile properties (e.g.,
{{firstName}},{{lastName}}). - Transactional Emails: Variable key names are 100% defined by you in your API request payload. If your existing SendGrid template uses
{{first_name}}, you can keep{{first_name}}in your AutoSend template as long as you pass"first_name"in your request’sdynamicDataobject. No variable key renames are required when migrating transactional HTML templates.
Conditional Blocks
Conditional syntax is identical across both platforms:
- SendGrid:
{{#if has_discount}} Your discount code is {{discount_code}} {{/if}} - AutoSend:
{{#if has_discount}} Your discount code is {{discount_code}} {{/if}}
API Payload Comparison
While template Handlebars syntax is compatible, the API payload field names differ:
- SendGrid API: Passes dynamic data inside
personalizations[].dynamic_template_datawith snake_case parametertemplate_id. - AutoSend API: Passes dynamic data in the
dynamicDatafield with camelCase parametertemplateId.
SendGrid Request:
{
"personalizations": [
{
"to": [{ "email": "user@example.com" }],
"dynamic_template_data": {
"first_name": "Alex",
"has_discount": true,
"discount_code": "SAVE20"
}
}
],
"template_id": "d-123456"
}
AutoSend Request:
{
"from": { "email": "auth@yourdomain.com", "name": "App" },
"to": { "email": "user@example.com" },
"templateId": "tpl_welcome_123",
"dynamicData": {
"first_name": "Alex",
"has_discount": true,
"discount_code": "SAVE20"
}
}