Closed Joerio closed 6 years ago
I second this, getting the same behavior no matter what I try. Has this library not been updated to use the new transactional templates? If not, is there a timeline for when support will be added? Hate the idea of creating new "legacy" templates ...
Same error here. As far as I understand, to use v3 templates with placeholders we need to provide "personalization.dynamic_template_data" section to the request JSON. Though c# library does not implement a way to do this.
I am seeing the same behavior on my end.
@ChrisASearles, @p-selivanov, @SlyCaptainFlint,
I will get some helpers added to support the dynamic templates soon; however, I don't have a firm timeline.
In the meantime, you can handcraft the request body like this.
With Best Regards,
Elmer
Only thing you have to do is adding
[JsonProperty(PropertyName = "dynamic_template_data", IsReference = false)] public object DynamicTemplateData { get; set; }
in the Personalizations class, and after that you can use it like this:
sendGridMessage.Personalizations[0].DynamicTemplateData = new { RegionHouseNumber = 28, EmployeeFirstName = "Chef" }
Please track support for this issue here moving forward. Thanks!
Thanks for the help @RoelVerhees!
Issue Summary
When I set a template from code to a template I just created with a single variable, and try to pass substitutions with the call I always get the following error: "BadRequest" - "{\"errors\":[{\"message\":\"Substitutions may not be used with dynamic templating\",\"field\":\"personalizations.0.substitutions\",\"help\":\"http://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#message.personalizations.substitutions\"}]}"
Steps to Reproduce
I tried it with the 'AddSubstitutions' and the 'AddTo' on the message, and also using the Personalizations.Add()
Technical details:
Edit Removed email adres from code