Reputation: 17
I'm using the following JSON to create a SendGrid template:
{ "personalizations": [ { "to": [ { "email": "[email protected]" } ], "custom_args": { "refnum": "222111", "datetime": "Monday, 4:30" } } ], "from": { "name": "From Person", "email": "[email protected]" }, "reply_to": { "name": "reply-to-name", "email": "[email protected]" }, "template_id": "template-id888939333", "tracking_settings": { "click_tracking": { "enable": true, "enable_text": true }, "open_tracking": { "enable": true }, "ganalytics": { "enable": true, "utm_source": "autoeml", "utm_medium": "email", "utm_content": "222111", "utm_campaign": "email" } } }
The template sends fine - I'm unable to get the handlebars to show in the email template, I've tried all of the following:
{{personalizations.custom_args.refnum}}
{{custom_args.refnum}}
{{refnum}}
Upvotes: 0
Views: 546
Reputation: 17
I made two updates to get this to work.
Instead of using the addCustomArg
library in PHP, I updated to use the addDynamicTemplateDatas
and also updated the handlebars to have a space before and after the variable name: {{ refnum }}
.
It still didn't come through in the template editor, but it is verified to be in the sent email.
Upvotes: 0