Unsubscribe Groups: A Developer’s ExampleRobert Acosta
For those already familiar with SendGrid, you are probably already aware that if a recipient unsubscribes from your mailing list, they can no longer receive any new email from you. If, for example, I am sending a marketing campaign and one of my campaigns doesn’t fair well, I might lose many possible recipients who decide to unsubscribe from all my future emails including password resets.
How can I prevent recipients from unsubscribing from my emails simply due to their disinterest in a particular campaign or topic? I can use SendGrid’s unsubscribe groups feature.
With unsubscribe groups, I can tag each email I send with an email group that is specific to the type of email I am sending. Now, my recipients have power over their email subscriptions. While the recipient may still unsubscribe from all future emails, they also have the ability to manage which emails they choose to receive and which they would rather not. This helps both the recipient and the sender.
From a Developer’s POV
As a developer, I use unsubscribe groups for transactional emails to allow my recipients the ability to turn off emails they would rather not receive while still receiving those emails that are important to them.
In my free time, I have been building an EMR (Electronic Medical Record) and emails are an important tool I use to notify the users of the EMR about updates and requests. For example, if a nurse forgets their password, an administrator may reset their password and the nurse will receive an email with a newly generated password.
One specific feature of the EMR is the ability for a charge nurse to change a patient assignment mid-shift. While the nurses on the floor will receive this notification on their tablet app, an email notification helps the nurses realize a change has been made sooner. Here is how I added this email notification to the EMR software.
1. I logged into the SendGrid Customer Portal and found the unsubscribe groups page.
2. I created a new email group called, “Patient Assignments.”
3. The email group ID is shown in the listing of email groups and I will need that in order to send an email using that email group. In this example, I will be using ID 124.
4. I then used the SendGrid Template Engine to produce an email that my recipients would receive.
5. After creating the template, the template ID is provided so that I may use it to send an email with this template. In this example, the ID for my template is e95d8718-383c-4741-9ebe-34d083b1cc10.
6. I then wrote the code using the SendGrid Java library. I made sure to specify the unsubscribe group ID and the template ID.
7. I’m done. Now when a patient assignment change is made, the affected nurses receive an email notification with the name and room of their new patient.
8. The nurse may choose to no longer receive these notification emails. In the past, they would need to unsubscribe from all emails including those in regard to password resets. With unsubscribe groups, the nurse may unsubscribe from patient assignment emails while still receiving other emails they are interested in.
9. A link is added to the bottom of all unsubscribe group emails that allows recipients to visit the subscription management page and make changes to their email subscriptions. As a user, you may add new email groups in the Customer Portal and those will appear on this page for the recipient.
Results and Insights
As a SendGrid user I can visit the Customer Portal and view the number of unsubscribes to any particular email group. This insight helps me understand if a particular feature or email campaign is disinteresting to my recipient and also helps me understand how to more effectively reach all of my recipients.
After using unsubscribe groups, I never send an email without an email group. So get out there and start using unsubscribe groups and give recipients control over their subscriptions!