-
Notifications
You must be signed in to change notification settings - Fork 723
Add Dynamic Template Support #591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
So I ended up starting my startup's transactional email project without knowing dynamic templating was new. While the management decision to make dynamic templating default when the SDK didn't support the new feature was questionable, with a bit of help from your support team, I wrote some code so I could use the SDK. Here's a Gist. https://gist.github.com/qgreg/4ea19b0241b8b74b88011e36b2641c3a The pieces & parts are there for a real update. I hope others can take what I wrote and run with it. Good luck! |
that's nice @qgreg. But for anyone relying on the SDK to stay in sync with the API, I find that extending classes and monkey patching the internals is overkill. A SendGrid API request is just JSON. Since For example - adding dynamic templates to an existing # build the request
request_body = mail.get()
# attach whatever data you want directly...
request_body['personalizations'][0]['dynamic_template_data'] = {
'whatever': 'data you want'
}
# mail it out
sg.client.mail.send.post(request_body=request_body) The SDK isn't doing anything magical. It's literally just building an internal dict, which is dumped to JSON via the call to |
Fixed in release v5.6.0 |
Hi ! I am not being able to find the documentation to add dynamic_template_data to the mail using this package. I only found how to configure the request body to accept dynamic data, link I want to use this package to create the request_body with the dynamic_template_data. Could you guys provide a snippet or some documentation please ? Thanks for your time |
@adriancast - does my snippet above help? |
Hi @leebenson , I just checked this commit and I found the example of how to use this new feature. Thanks for your time ! 🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉 |
HI @adriancast, You may also find updated documentation here. Thanks! With Best Regards, Elmer |
@thinkingserious The new documentation link gives 404 |
@pavs94 I've found out that actual docs could be found here https://github.com/sendgrid/sendgrid-python/blob/master/use_cases/transactional_templates.md |
I tried using the same code as in the below link But I am still getting 400 bad request error. I am using sendgrid==6.0.4. Any idea what could be the issue? |
Got the issue. I have been using legacy templates. Using the transactional template solved the issue. |
Issue Summary
On 7/24/2018, our team publicly launched dynamic content for transactional templates. It is now available for all customers sending over v3 of our Mail Send API. Iterate over lists, handle conditionals and more, thanks to native support for a subset of Handlebars syntax!
More information can be found in our blog post announcement.
You can currently use this feature by manually creating the request body as shown here.
Now, we need to create helper code and examples for this SDK.
Acceptance Criteria
Documentation
The text was updated successfully, but these errors were encountered: