Sendgrid-nodejs: Can't specify Unsubscribe tags in Transactional template

Created on 22 Oct 2018  Â·  6Comments  Â·  Source: sendgrid/sendgrid-nodejs

Issue Summary

I have a transactional email template set up and working. However, I can't figure out how to set the tags in the Unsubscribe module -- i.e. [Sender_Name], [Sender_Address], [Sender_City], etc.

Right now when I send an email those tags just appear as text (e.g. "[Sender_Name]") without being swapped out.

I've reviewed the API docs and searched past issues here and can't find any other mention for how to specify values for the "Sender" tags programmatically.

Steps to Reproduce

Here's what I've tried:

  1. Created a Sender in SendGrid (Marketing > Senders) with details thinking this info would autopopulate the tags, but they aren't show up
  2. Created an Unsubscribe Group in SendGrid (Marketing > Unsubscribe Groups) this info now autopopulates the unsubscribe link only in the module

Is it possible to send that information via the API call? Or is there some other method for specifying this information?

Technical details:

  • sendgrid-nodejs Version: 6.3.1

Most helpful comment

I've received a response back from SendGrid support -- what they said:

  • Senders defined in the admin only populate Marketing emails, not Transactional emails
  • You also can't supply Sender information via the API, it has to be manually included
  • This means that the Unsubscribe module that autopopulates in Transactional email templates is essentially unusable.
  • Also, they let me know that _you don't even need to include_ an Unsubscribe module in a Transactional email even though the include one automatically (and display warnings in SendGrid to the contrary), so you can choose whether to manually include that information or not.

I did discover that you can specify an Unsubscribe Group ID via the API fi you want to set that. You can specify it in your message object as:

asm: {
group_id: yourGroupID
}

I spent a full day trying to figure all of this out so I hope SendGrid updates their documentation -- as well as their product -- to clarify these things. And maybe this will save someone else some hours of digging.

All 6 comments

I've received a response back from SendGrid support -- what they said:

  • Senders defined in the admin only populate Marketing emails, not Transactional emails
  • You also can't supply Sender information via the API, it has to be manually included
  • This means that the Unsubscribe module that autopopulates in Transactional email templates is essentially unusable.
  • Also, they let me know that _you don't even need to include_ an Unsubscribe module in a Transactional email even though the include one automatically (and display warnings in SendGrid to the contrary), so you can choose whether to manually include that information or not.

I did discover that you can specify an Unsubscribe Group ID via the API fi you want to set that. You can specify it in your message object as:

asm: {
group_id: yourGroupID
}

I spent a full day trying to figure all of this out so I hope SendGrid updates their documentation -- as well as their product -- to clarify these things. And maybe this will save someone else some hours of digging.

Can confirm the exact same issues as described above. Spent lots of time trying to troubleshoot and reading through docs. Can someone from SendGrid please look into this and provide a resolution?

Same problem here.

An example in the docs would be very useful for this case. In our use case, we have a variety of transactional email types that are non-critical (eg. user-relevant data change) and some that are (password reset). We have to be able to offer unsubscribe for the "optional" transactional emails and not for the others.

Got this back from SendGrid support. Leaving it here for those who come looking for support.

Thanks for reaching out to our support team.
This is an issue that we are aware of. Essentially, the root of the problem is that the unsubscribe module offered in the build section of Transactional Templates contains the incorrect syntax. I do apologize for that and I understand completely that this is very confusing. While we are currently working with the product team to work this kink out, I would like to offer a workaround.
Because Transactional Templates utilizes "handlebars" syntax {{ }}, in order to replicate the same sender information being populated you will need to follow these steps:
• Add an unsubscribe module but turn "address line" off.
• Add a text module and use the following syntax to populate it:
{{sender_name}}, {{sender_address}}, {{sender_city}}, {{sender_state}}, {{sender_zip}}
Note: the difference in syntax from the single square brackets to the double curly brackets.
• Adjust your JSON request payload to include the following:

"dynamic_template_data": { 
    "subject": "your subject",
    "sender_name": "John Doe",
    "sender_address": "Street 123",
    "sender_city": "City",
    "sender_state": "ST",
    "sender_zip": "12345"
}

Let me know if this helps and if you have any other questions,
Cody | Associate Support Engineer

Got this back from SendGrid support. Leaving it here for those who come looking for support.

Thanks for reaching out to our support team.
This is an issue that we are aware of. Essentially, the root of the problem is that the unsubscribe module offered in the build section of Transactional Templates contains the incorrect syntax. I do apologize for that and I understand completely that this is very confusing. While we are currently working with the product team to work this kink out, I would like to offer a workaround.
Because Transactional Templates utilizes "handlebars" syntax {{ }}, in order to replicate the same sender information being populated you will need to follow these steps:
• Add an unsubscribe module but turn "address line" off.
• Add a text module and use the following syntax to populate it:
{{sender_name}}, {{sender_address}}, {{sender_city}}, {{sender_state}}, {{sender_zip}}
Note: the difference in syntax from the single square brackets to the double curly brackets.
• Adjust your JSON request payload to include the following:

"dynamic_template_data": { 
    "subject": "your subject",
    "sender_name": "John Doe",
    "sender_address": "Street 123",
    "sender_city": "City",
    "sender_state": "ST",
    "sender_zip": "12345"
}

Let me know if this helps and if you have any other questions,
Cody | Associate Support Engineer

Hi ,

Any one able to solve this problem.
I am facing the same issue. I have test.html which I try to create campaign through V3 API.
========test.html=====

Unsub

===============================
I wish to create campaign and schedule it but Getting the error of Unsubscribe tag

If any one solve this can you please share the solution .

Best regards,

Setting the asm property as shown below worked for me.

      asm: {
        groupId: 111
      },

Without the above setting, the links from the Unsubscribe option under Design Editor would just show the 'Unsubscribe' text without URL in emails.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

polkhovsky picture polkhovsky  Â·  3Comments

mikemaccana picture mikemaccana  Â·  4Comments

umarhussain15 picture umarhussain15  Â·  3Comments

Loriot-n picture Loriot-n  Â·  4Comments

kiranshashiny picture kiranshashiny  Â·  4Comments