sendgrid/sendgrid-nodejs

Substitutions not working

bramvbilsen opened this issue · 0 comments

Issue Summary

Subsitution tags specified in the personalizations array are not being substituted using sendMultiple. Also, only the first object of personalizations is used, resulting in only a single email being sent instead of multiple.

Steps to Reproduce

  1. Send an email using sendMultiple including substitutions for each element in the personalizations field.
  2. Look at received email, the substitution tags are not replaced

Code Snippet

sendgrid.sendMultiple({
    personalizations: [
        {
            to: {
                email: "john@doe.com",
                name: "John1",
            },
            substitutions: {
                "-name-": "John1",
            },
        },
        {
            to: {
                email: "bob@doe.com",
                name: "Bob",
            },
            substitutions: {
                "-name-": "Bob",
            },
        },
    ],
    from: {
        email: "my@email.com",
    },
    subject: "Welcome!",
    text: "Hi there -name- 👋",
});

Technical details:

  • sendgrid-nodejs version: ^7.6.2
  • node version: v16.13.2