sendgrid / sendgrid-java

The Official Twilio SendGrid Led, Community Driven Java API Library
https://sendgrid.com
MIT License
485 stars 409 forks source link

How to specify dynamic template version when sending a email? #676

Closed mih-kopylov closed 3 years ago

mih-kopylov commented 3 years ago

In my use case I have a dynamic template that is used for transactional emails in production. And I want to upgrade the template and bring some changes there. In order to do that I create another version of template, thus I have two of them: first, active - used in production, second - inactive, not used in production. For sure, I want to test the second version of the template in development environment. In order to do that, I need to specify template version which I want to use by Sendgrid to send an email. Otherwise the first version will be used, the same as in production. But I can't find an appropriate request field for that in v3 mail/send API https://sendgrid.api-docs.io/v3.0/mail-send/v3-mail-send I've also noticed an API to activate specific dynamic template version https://sendgrid.api-docs.io/v3.0/transactional-templates-versions/activate-a-transactional-template-version. But that doesn't seem the one that I can use, because if I change active template version to the second, it will start being used immediately at production environment, while I expect only development one to be able to use it.

Is there a way to specify dynamic template version when sending a email? If not, is there a chance to implement such a feature?

eshanholtz commented 3 years ago

There is no way to specify a dynamic template version when sending an email. That is, you may not have multiple active versions of the same dynamic template. The closest you'll probably find to a workaround is creating a separate dynamic template to use for testing. For more help with this issue, I recommend reaching out to support.

thinkingserious commented 3 years ago

Hello @mih-kopylov,

Thanks for submitting a GitHub issue! We are very sorry that you are running into this problem. In order to better serve you, as this does not present itself as a library specific issue, we would like to ask that you reach out to our support team at https://support.sendgrid.com.

Thank you!

SendGrid DX Team