What parameters can I pass into my magic link?
Set Admin Email via Magic Link Parameter
Here's how this is useful...
The first time the parameter is used for a magic link, a new sandbox will be created and the admin email address will be set to the specified email.
Repeat calls to the same magic link — with the same admin email — would redirect the user into the existing sandbox and not create a new one.
How to use the Email Parameter
To set the email address for a sandbox, add the following code snippet to the end of the magic link URL (after everything else that is already in the magic link address).
&email=[[email protected]]
Replace the example email shown with the properly-escaped email address you’d like to set the default WordPress account to.
Real-Life Example
This new capability is super helpful when sending magic links to customers and leads. Let’s say I want to send a magic link to a list of leads via email, using my preferred email service provider (ESP).
If I send my link out to my email subscribers using the Liquid tags my ESP supports, the link might look something like the following:
https://dashboard.wpsandbox.app/magic/1Y1X53XX-2X91-42XX-X396-X5X07XXXX317?signature=15xx6a57c3bc3b94fe6bbf464554ba3791xyzz4d0bc1d401a3d730efe9d5ea9fa&email={{ email_address }}
Or, more simply:
https://dashboard.wpsandbox.app/magic/[magic-link-id]?signature=[signature]&email={{ email_address}}
If each person on my list clicks their link (100% conversion rate! Unheard of! Woo-hoo!) then you’ll see that 100 sandboxes have been created (one per person, per click). As you'd expect. Here's where it gets really cool...
But, as we know, sandbox users sometimes forget to set their sandbox password, and they also often forget to bookmark the address in their browser. If the person closes their browser tab and wants to get back into their sandbox, it makes sense that they will find the email from you and click the link again.
With a normal magic link (without an email address parameter), clicking the magic link again would spin up a brand new sandbox (and orphan the old one) — each time the person clicked the link. Now, if you've provided an email address in the magic link, the person will be directed to the same sandbox they created with their first click.
In addition, this new capability can be helpful when sharing a sandbox with your team, internally, for customer support or quality assurance (QA) testing.
Properly Escape Email Addresses
It’s important to make sure email addresses are properly escaped for use in a browser address. Especially with emails that have a plus sign (+) in them. For example…
Original Email (Unescaped)
[email protected]
Escaped Email
humphrey.bogart%2Bsupport%40email.com
If you’re unsure of the proper way to escape special characters, below is a quick cheatsheet for the most common characters found in email addresses:
If you’d like to study this further, here’s a handy guide to encoding characters, and here’s a simple web-based tool that will encode and decode strings of text for you.
What you can expect when using this optional email parameter
With this new email parameter, the first time each person clicks on their magic link, our system will create a unique sandbox with the administrator account email set as requested.
The second time that same person clicks the same link, they’ll be logged into their existing sandbox.
Of course, just like before, if anyone uses your magic link without an email parameter, a brand new sandbox will be claimed.
More parameter options are coming soon!
Here's what we're working on...
-
Magic Link Parameter to Require Login after Sandbox Creation
-
Magic Link Parameter to Auto-Login as a Specified User after Sandbox Creation
Interested in more magic link parameters? Please let us know how this would help you!