Overview
Gmail (and maybe other mail providers) offer a feature where the user can click to "List Unsubscribe", this is different than clicking on the opt-out link that a marketer might put at the bottom of the email. The default Cordial behavior is to unsubscribe the email address when this event is received. In some cases, this might not be the desired behavior. For example, your brand might have a national list and a local list. A customer might want to continue to receive your national email, while also wanting to be removed from your local email, or vice versa. This workflow will show the steps needed to accomplish this with the Gmail List Unsubscribe.
Add List to Message
Before we begin this section, we should point out that the word list means different things to different vendors. To be successful with this use case, we need to add the Cordial list to the email so that if the Customer List Unsubscribes, we know which list to remove them from. And then Second we need to add the Gmail List Name so that the user sees the correct display when they click to List Unsubscribe.
{$utils->addSendProperties(['listID' => 'local_email'])} {* Cordial List Name *} {$utils->setEmailHeaders(['List-ID' => 'Local Email List'])} {* List Name as Displayed
in Gmail *}
A view of the List in the Cordial Platform

A view of the List-ID seen in Gmail

Create Data Job
Create an automated Event Triggered Data Job, with the triggering event email-mta-optout-bypass.
{$data.metadata = $utils->renderInfo()} {$data.blockUpdate = 0} {if in_array($triggerData.sp.listID, $contact.lists|default:[])} {* This users is on the list used for the unsub *} {$updateRecord.data[$triggerData.sp.listID] = false} {else} {* This users is NOT on the list used for the unsub, so we optout as failsafe *} {$updateRecord.data.channels.email.address = $contact.channels.email.address} {$updateRecord.data.channels.email.subscribeStatus = 'unsubscribed'} {/if} {$updateRecord.waitForResult = true} {$updateRecord.suppressTriggers = true} {$updateRecord.forceSubscribe = false} {if not $data.blockUpdate and not $data.metadata.preview} {$updateRecord.result = $utils->updateContact($updateRecord.data, $updateRecord.waitForResult, $updateRecord.suppressTriggers, $updateRecord.forceSubscribe)} {if not empty($triggerData.sp.transportID)} {$updateRecord.sparkpost_result = $utils->removeSparkpostSuppression("email:{$contact.channels.email.address}", $triggerData.sp.transportID, $updateRecord.waitForResult)} {/if} {/if} {if $data.metadata.preview} <h2>Debug $updateRecord</h2> {$utils->jsonPrettyPrint($updateRecord)} <h2>Debug $data</h2> {$utils->jsonPrettyPrint($data)} <h2>Debug $contact</h2> {$utils->jsonPrettyPrint($contact)} {/if}
Comments
0 comments
Please sign in to leave a comment.