diff --git a/use-cases/README.md b/use-cases/README.md index 14552536c..f11dbe798 100644 --- a/use-cases/README.md +++ b/use-cases/README.md @@ -9,6 +9,7 @@ This documentation provides examples for specific SendGrid v3 API use cases. Ple * [Handling Success/Failure/Errors](https://github.com/sendgrid/sendgrid-nodejs/blob/master/use-cases/success-failure-errors.md) * [Advanced Usage](https://github.com/sendgrid/sendgrid-nodejs/blob/master/use-cases/advanced.md) * [Transactional Templates](https://github.com/sendgrid/sendgrid-nodejs/blob/master/use-cases/transactional-templates.md) + * [Legacy Transactional Templates](https://github.com/sendgrid/sendgrid-nodejs/blob/master/use-cases/transactional-legacy-templates.md) * [Attachments](https://github.com/sendgrid/sendgrid-nodejs/blob/master/use-cases/attachments.md) * [Customization Per Recipient](https://github.com/sendgrid/sendgrid-nodejs/blob/master/use-cases/customization.md) * [Manually Providing Content](https://github.com/sendgrid/sendgrid-nodejs/blob/master/use-cases/manual-content.md) diff --git a/use-cases/transactional-legacy-templates.md b/use-cases/transactional-legacy-templates.md new file mode 100644 index 000000000..40a1dda50 --- /dev/null +++ b/use-cases/transactional-legacy-templates.md @@ -0,0 +1,64 @@ +# (LEGACY) Transactional Templates + +For this example, we assume you have created a [transactional template](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html). Following is the template content we used for testing. + +Template ID (replace with your own): + +```text +13b8f94f-bcae-4ec6-b752-70d6cb59f932 +``` + +Email Subject: + +```text +<%subject%> +``` + +Template Body: + +```html + +
+Hello HTML world!
', + templateId: '13b8f94f-bcae-4ec6-b752-70d6cb59f932', + substitutions: { + name: 'Some One', + city: 'Denver', + }, +}; +sgMail.send(msg); +``` + +Alternatively, you may specify the substitution wrappers via the msg object as well. This will override any wrappers you may have configured globally. + +```js +const msg = { + ... + substitutionWrappers: ['{{', '}}'], + ... +}; +``` diff --git a/use-cases/transactional-templates.md b/use-cases/transactional-templates.md index aae92a8d0..0e8c40077 100644 --- a/use-cases/transactional-templates.md +++ b/use-cases/transactional-templates.md @@ -1,19 +1,11 @@ -# (LEGACY) Transactional Templates - -IF YOU ARE USING OUR NEW TEMPLATES, PLEASE SEE [THIS ISSUE](https://github.com/sendgrid/sendgrid-nodejs/issues/703). +# Transactional Templates For this example, we assume you have created a [transactional template](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html). Following is the template content we used for testing. -Template ID (replace with your own): - -```text -13b8f94f-bcae-4ec6-b752-70d6cb59f932 -``` - Email Subject: ```text -<%subject%> +{{ subject }} ``` Template Body: @@ -24,13 +16,13 @@ Template Body: