Skip to content
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

Add Dynamic Template Support #260

Closed
thinkingserious opened this issue Jul 26, 2018 · 9 comments · Fixed by #263
Closed

Add Dynamic Template Support #260

thinkingserious opened this issue Jul 26, 2018 · 9 comments · Fixed by #263
Assignees
Labels
difficulty: medium fix is medium in difficulty status: help wanted requesting help from the community type: twilio enhancement feature request on Twilio's roadmap

Comments

@thinkingserious
Copy link
Contributor

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

@thinkingserious thinkingserious added status: help wanted requesting help from the community difficulty: medium fix is medium in difficulty up-for-grabs type: twilio enhancement feature request on Twilio's roadmap labels Jul 26, 2018
@devchas
Copy link
Contributor

devchas commented Aug 1, 2018

I can take a crack at this one!

@birjup
Copy link

birjup commented Aug 7, 2018

Hi,
Will you do it something like this, or are you planning anything drastically different?

DynamicTemplateData map[string]string `json:"dynamic_template_data,omitempty"`

@birjup
Copy link

birjup commented Aug 7, 2018

By the way, there seems to be a bug/feature where specifying html or text content stops the application of any handlebars

@devchas
Copy link
Contributor

devchas commented Aug 7, 2018

@birjup I am planning to do something like that

@devchas
Copy link
Contributor

devchas commented Aug 7, 2018

@birjup I actually had to do something like the following. You can't use a string value in the map because the JSON can be of arbitrary structure so that you can use the iteration and deep object features of handlebars. I am writing this so you pass a JSON string into the helper method

DynamicTemplateData map[string]interface{} json:"dynamic_template_data,omitempty"``

@birjup
Copy link

birjup commented Aug 8, 2018

Great, makes sense. Thanks for the update

@nickhudkins
Copy link

@devchas take a look!

@devchas devchas mentioned this issue Aug 10, 2018
6 tasks
@devchas
Copy link
Contributor

devchas commented Aug 10, 2018

Awesome thanks @nickhudkins - I had already done most of the work and had some more comprehensive examples that are aligned with the general dynamic template docs so I just submitted a separate PR #263 but it was helpful to see we approached this the same way

@nickhudkins
Copy link

Works for me! Needed to get a feature out the door at work so I figured I’d push up what I did!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: medium fix is medium in difficulty status: help wanted requesting help from the community type: twilio enhancement feature request on Twilio's roadmap
Projects
None yet
5 participants