A/B testing SMS with Optimizely
With 2018 just around the corner, your company will likely be exploring new channels to reach out to your customers. Before you rush off to start a podcasting channel, create video ads, or rebuild your mobile app from scratch, take a moment to consider improving your company’s mobile text messaging (SMS) channel.
Around 80% of customers open every single SMS text message they receive, and a recent Salesforce survey found that the SMS text messaging channel was as effective as social media marketing, mobile applications, and a corporate website. With mobile and tablet internet usage overtaking desktop internet usage in late 2016, it is important that you have an effective mobile marketing strategy.
Here at Optimizely, we believe you should experiment everywhere, and now, with Optimizely X Full Stack, experimenting on your SMS marketing campaigns is simpler than ever. This guide will show you how to set up a simple A/B test using the Twilio SMS APIs. It will bucket incoming visitors who text the number with “Hello” into variation A or B and respond with different messages to see which message users respond to more favorably. You can extend this example to experiment on any messages sent to your users via SMS to increase conversion rate, engagement, or overall response rate.
Setting up your Optimizely Experiment
You can follow the Full Stack Getting Started Guide to create your very first experiment; we will name it `Twilio_SMS_Experiment`. We can make two variations for the experiment, and add metrics for positive and negative responses.
Configure your Twilio Functions
Navigate in your Twilio console to Runtime > Functions to create a new Twilio Serverless Function. To make it easier to initialize your Twilio Client, check the box next to “Enable ACCOUNT_SID and AUTH_TOKEN”. In order to use the Optimizely SDK inside a serverless function, you need to configure SDK and its dependencies as requirements of the function which you can do through the Configure panel.
Implement the Twilio Function in Node
Now that we’ve configured your Twilio Functions environment, we will create a new function from the Hello SMS template. You can copy over the sample code from our demo here.
Make sure you replace the URL to your JSON datafile instead by going to Settings > Datafile and copying the datafile link shown for your project. The JSON datafile is the instruction set for the Optimizely SDKs–it contains information about the project’s experiments, audiences, events, and more. By getting the datafile, the Optimizely SDK will be initialized with information on the experiment we just created, and can properly bucket users into your experiment and track results.
Link Function to Twilio SMS Number
Finally, return to your Twilio phone numbers console and click on the active number you just purchased. Configure the number to respond with the function we just created when a message comes in.