How to Trigger Automated Emails from xAPI Data

How to Trigger Automated Emails from xAPI Data tutorial cover photo

If you’re using the Experience API (xAPI), then you’re likely tracking learning and performance data to learn more about human behavior. 

In this tutorial, I’ll show you how to use that xAPI data to trigger automated emails. This lets you deliver just-in-time support to people right when they need it. For example, you can use this approach to:

  • Send an email to someone whenever they fail an eLearning quiz or assessment. The email can include helpful resources, tips about how to improve, or contact information for a mentor who may be able to help.
  • Send an email to an employee whenever they schedule their first sales call with a lead. This email can include important reminders about how they should handle the call.
  • Send an email reminder to someone who has not engaged with a learning product for a given amount of time. These nudges can remind people that helpful learning content is available.
  • And the list goes on! If you have any questions about what’s possible, then feel free to ask them in my eLearning Slack community.

Since this tutorial assumes that you’re already familiar with xAPI and receiving xAPI data, you should have a handle on what xAPI is and how it works. Here are some helpful resources if you are new to xAPI:

Finally, we’re going to use the following tools to send automated emails from xAPI data:

  • Watershed LRS. We’re using this tool because it integrates with Zapier (which is necessary for this process). If you use a different LRS, then you can forward xAPI statements from your existing LRS to the Watershed LRS. Create a Watershed Essentials LRS before continuing.
  • Zapier. We’re using this tool to connect Watershed LRS and an email automation tool. Zapier is the “glue” that makes other tools work together nicely. Please create a Zapier account now if you do not already have one. You need the Zapier Starter features to follow along with this tutorial.
  • An email automation tool. I use Drip for the purposes of this tutorial, but you can find similar functionality in ActiveCampaign, ConvertKit, and Mailchimp. If you would like to follow along with this tutorial, then you should start a free trial with Drip.

With your accounts ready and your background knowledge acquired, let’s dive in!

Create the Zap

First, we need to create a Zap that tags the person in Drip whenever they generate a specific xAPI statement. For example, whenever Watershed LRS receives an xAPI statement that someone failed a quiz, we need it to tag the user in the email automation tool with a “failed_Quiz” tag.

Begin creating the Zap by signing into Zapier and selecting the black “MAKE A ZAP” button on the left toolbar. 

select the make a zap button in zapier

Define the Trigger xAPI Statement

Once the interface opens to create a new Zap, we must select the trigger app and event. Search for Watershed LRS to set the trigger app.

select watershed lrs as the trigger app

Choose “New Statement” as the trigger event, then select the blue “CONTINUE” button.

Next, configure your Watershed LRS account with Zapier (if you have not done so already). You will need your Watershed LRS endpoint, key, and secret for this step. 

If you need additional guidance with this step, then view the “Configure the Watershed LRS Connection” section of the Send an xAPI Statement from a Glide Button tutorial.

Once you’ve configured your Watershed LRS account, you need to fill out the “Customize Statement” section of the trigger.

This is where you tell Watershed LRS which statements will trigger the Zap. The values you enter here serve as filters. Only the statements that match the filters you add will trigger the Zap.

For example, for my xAPI Challenges App, I created a Zap like this for each of the challenges. I added the activity ID and verb ID to ensure that the specific Zap would only fire when someone passes the challenge.

change the statement elements to filter the statements that should trigger the zap

Use this approach to define the xAPI statement elements that should trigger your Zap. 

Remove “mailto:” from the Email Address

As you likely know from your previous experience with xAPI, the xAPI actor.mbox property includes “mailto:” before the user’s email address. Since the email automation tool needs to identify people via their email addresses (without the “mailto:” in front of them), we need to filter out the “mailto:”. 

To do this, add another step in your Zap. Choose the “Formatter” option.

Important note: To create multi-step Zaps and use formatters, you must have, at minimum, the Zapier Starter plan. You can create a similar workflow with two Zaps and Google Sheets to remove “mailto:” from the email address, but if you’re using this approach in a production environment, you will likely have the Zapier starter plan. Let me know in Slack if the Google Sheets version of this tutorial would be helpful.

Select Formatter in Zapier

Where it asks you to choose the action event, select “Text.”

Select Text as the action event

Select the blue “CONTINUE” button, then select “Extract Email Address” in the “Transform” dropdown box. 

Where it asks you which input value to include, select “Actor Email.”

Extract email address from the Actor Email value

Select the blue “CONTINUE” button again. Now you will have the actor’s plain email address available for the next step of our Zap. 

Tag the Person in your Email Automation Tool

Add another step to your Zap. This time, select Drip (or your email automation tool) as the app and “Add Tag to Subscriber” as the action event.

Select Drip and Add Tag to Subscriber in Zapier

Add your Drip account in the next step, then, when you see the “Email Address” field, select the “Text” formatter that we set up and the “Actor Mbox” property within it.

Select the Actor Mbox property from the Text step

This gives Drip the plain email address that it can use to identify a person and send them emails.

Finally, add the tag that you would like users to be tagged with in Drip whenever they trigger the xAPI statement defined in the first step of this Zap.

Add the tag that you would like to tag people with in your email automation tool

Press “CONTINUE,” send a test statement, and then turn on the Zap by selecting the toggle at the bottom (or top right) of the screen.

Now every time that someone generates an xAPI statement with the criteria that you decided, they will get tagged with the corresponding tag in your email automation system.

Build the Email Workflow

Sign in to Drip, hover over the Automations tab, then select Workflows.

Select Workflows in Drip

Select the “New Workflow” button in the top right and give the workflow a relevant name. In my case, I will name the workflow “Passed Write xAPI Statement Quiz.”

Once you’re on the Workflow canvas, select the “Define your trigger” button. 

Select Define your trigger

In the “Edit Trigger” dialogue box, change the trigger event to “Applied a tag” and the tag to whatever you named the tag in Zapier. Select the “Update Trigger” button once this is configured.

Change the trigger to Applied a tag and set the tag that you defined in Zapier

Now you can add actions to this workflow in Drip. Whenever someone is tagged with the given tag (which is handled by our Zap), we can send them emails.

Select the small plus icon beneath the “Applied tag” rectangle to add a “Send Email” action.

Select the small plus icon

Select the “Action” box, then change the action to “Send a one-off email.” Decide whether you’d like to use the visual builder or the text/html email builder, then select your choice.

Send a one-off email with the text/html builder

Now you can set your email subject line and add contents to the body of the email. This is the email that people will receive whenever they generate an xAPI statement defined.

Populate the email with your content

Select the “Update Action” button at the bottom of the screen whenever you are happy with the email, then select the left-facing caret (<) to the left of the workflow title to return to the workflow canvas.

Finally, select the “Start Workflow” button in the top right to turn this functionality on. Now, whenever someone generates an xAPI statement that matches the given criteria, they will receive the email that you created!

You can add much more functionality to this workflow (such as delayed reminders if the user does not take additional action within a set number of days). Check out the Drip workflow documentation to learn more.

Conclusion

By following the steps in this tutorial, you can send automated emails based on the actions that people take in learning experiences and on-the-job. These emails can provide helpful resources, tips, and contact information. 

You can also use this technique to create learning experiences that include automated emails as a core part of the experience. For example, in my xAPI Challenges App, users receive emails with information on what to do next only when they pass a specific quiz.

If you have any questions about this tutorial or what’s possible with xAPI, then please join my eLearning Slack community and ask away. See you there!

Featured Tutorials

View all tutorials