Document toolboxDocument toolbox

Data Refactor - Magic Link

Table of contents


What is a Magic Link?

A Magic Link or secure login link is a unique link a customer will receive via email that will allow them to log in without entering a password.

The link and email can be generated one of two ways:

  • An API call to the magic link service

  • Clicking a button on the WordPress site, which generates a secure login link.

You can also link it to other actions such as a password reset. Once the user clicks on the Magic Link and is logged in, the user can be displayed a prompt to reset their password.


How is it used?

Below are a few use cases in which your business might utilize a Magic Link.

Use Case - Website Activity

Description

Use Case - Website Activity

Description

Allow customers secure access to paid content

If a customer reaches the login page and can’t remember their login information, they can be presented with the option to be sent a secure login link aka a Magic Link. This link is sent to the customers email address on file. When the customer clicks on the link, they will have access to all of their purchased content for a certain period of time.

Allow customers to reset their password

Similar to the use case above, If a customer reaches the login page and can’t remember their login infomation, they can be presented with the option to reset their password. By selecting this option, the customer will be emailed a secure login link aka Magic Link. When the customer clicks on the link, they will be automatically logged in, but they will also be prompted to reset their password.

Use Case - Transactional Activity

Description

Use Case - Transactional Activity

Description

Secure access to paid content/articles via email alerts

If a customer receives email alerts for a publications they have paid for, that email alert could contain a link to a specific article. By clicking on that link, the customer will automatically be logged in and redirected to that article.

Allow new customers temporary access to new orders

When a customer places a new order (whether a subscription, product, or AMB item) they will receive a confirmation email with a temporary access link. This access is temporary because the purchase has not yet reached Advantage/finished processing.

Allow existing customers access to new orders

Existing customers can use a link sent via a confirmation email to get access to newly purchased content that has not yet been processed in system. Once the purchase is fully processed, the customer will have access to this content using their standard login credentials.


Website Activity

Website activity covers two main scenarios. Your website might offer two options when a customer forgets their password: Reset Password and Send Secure Login Link.

If a customer reaches the login page and can’t remember their login information, they can be presented with the option to reset their password. By selecting this option, the customer will be emailed a secure login link aka Magic Link. When the customer clicks on the link, they will be automatically logged in, but they will also be prompted to reset their password.

Similar to the above scenario, if a customer selects the option to be sent a secure login link aka a Magic Link, they will be emailed a secure link. When the customer clicks on the link, they will have access to all of their purchased content.


Workflow


 


What you will need to do

  1. Enable the forgot password functionality and customize the language and variables in WordPress

  2. Create a template in Blueshift

  3. Create an Event Triggered campaign in Blueshift


Enable the Forgot Password Functionality and Customize the Language and Variables in WordPress

What does this do?

Enabling the forgot password functionality will allow you to customize the language and variables needed to send emails from Blueshift and display notifications on your website. Once enabling and saving, an event will be pushed Blueshift which will be referenced in event triggered campaigns.

  1. Navigate to Middleware 2 in the left menu and click on the Settings tab

  2. Locate the option Enable Secure Login/Magic Link For Password Reset and select On to enable. This will make the secure login link appear on your website

  3. Scroll down and locate the Emails section.

  4. Turn HTML Emails On and select Blueshift next to Send Email Through

  5. Navigate to the Language Variables tab under Middleware 2. Customize the language for each of the variables.

These variables are used for both, forgot password and secure login requests from your website, so be sure to update all that will be used.

6. Next, create a template in Blueshift.


Create a Template in Blueshift

  1. In Blueshift, create the email template by navigating to Creatives>Email

  2. Click on + Template and select HTML Editor

  3. Code and customize your template however you wish. For the body, however, you will need to enter the following.

{{html_body}}

This will use the event that has been pushed to Blueshift to insert the correct language variable and secure login link into your email based on the request coming from your website.

4. Next, create the campaign.


Create an Event Triggered Campaign in Blueshift

  1. In Blueshift, navigate to campaigns

  2. Click + Campaign and select Event Triggered

  3. In the When Event Occurs field, select the event forgot_password

  4. Attach the template created in the previous step

  5. Once the campaign is scheduled and running, you’re good to go!


Transactional Activity

These scenarios will use endpoints and external fetches in Blueshift to allow you to send a variety of magic link functions.



What you will need to do

  1. Enable the secure link (Magic Link) functionality on your website

  2. Set Up External Fetch for Secure Link Login

  3. Set up the Blueshift template


Enabling Secure Login Link and Magic Link Password Reset on your Website

What does this do?

Enabling the secure login/forgot password functionality will allow you to customize the language and variables needed to send emails from Blueshift and display notifications on your website.

  1. Navigate to Middleware 2 in the left menu and click on the Settings tab

  2. Locate the Emails section.

  3. Turn HTML Emails On and select Blueshift next to Send Email Through

  4. Navigate to the Language Variables tab under Middleware 2. Customize the language for each of the variables.

These variables are used for both, forgot password and secure login requests from your website, so be sure to update all that will be used.

6. Next, set up an External Fetch in Blueshift.


Setting Up External Fetch for Secure Link Login

What does this do?

The external fetch for the secure login link is going to use Middleware to return the customer number and limit access to active purchases the customer has made. This allows the customer to have access to the correct content once clicking on the secure login link.

  1. In Blueshift, expand the Creatives menu and select External Fetches

  2. Create a new external fetch and complete the following fields:

 

Alias

Enter the name of the external fetch

HTTP Method

POST

Auth Header

token

Auth Token

MW Auth Token - this is required for all endpoints

URL (Endpoint)

Use Case

Endpoint

 

 

Grant access by email address

https://magiclink.14west.io/access/email

 

Grant access by customer number

https://magiclink.14west.io/access/customernumber

 

Grant temporary access by email

 

Grant temporary access by customer number

 

Create password reset link

 

Create user password

 

Body

Use the Request Body from the Swagger docs above to create the body of the external fetch.

Example:

 


Setting up the Template in Blueshift

  1. In Blueshift, create a new HTML template

  2. Navigate to the Data tab and expand External Fetch and enter the one that was created in the last step. This will be listed under the alias name.

3. Next, you will need to add the external fetch to the content of your email via a link.

4. Navigate to the content tab. Add and edit one of the following links:

The following will need to be updated/replaced in the link:

https://mywordpresssite.com

This needs to be replace with the website URL to the site which the customer will gain access.

aliasname

Replaced with the external fetch.

Example

 

<a href="https://supercoolfinancial.com/?sk={{external_fetch.magiclinkbycustomernumber.Payload.link}} ">Click Here to Login</a>

The following will need to be updated/replaced in the link:

https://mywordpresssite.com

This needs to be replace with the website URL to the site which the customer will gain access.

aliasname

Replaced with the external fetch.

https://mywordpressite.com/specific_arcticle

Replace with the link that will be used as the redirect.

Example

 

<a href="https://supercoolfinancial.com/?sk={{external_fetch.magiclinkbycustomernumber.Payload.link}}&skoverride=https://supercoolfinancial.com/may2021_arcticle">Click here to access your May 2021 article.</a>


 


Related FAQS


Related Content


Level up with a Masterclass

Evolve course title

Get started!

Evolve course title

Get started!


 

com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'html-macro' is unknown.