How to Trigger Automated Emails from xAPI Data

Updated on 
August 5, 2022
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:

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:

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 (

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.

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

Explore more content

Explore by tag