Sending SMS messages from Mixpanel

Introduction

Mixpanel allows you to tie data to a specific user, creating a profile. This is where you store things like their phone number, where they came from, or their age. When you include a phone number, you can start sending targeted SMS notifications right from Mixpanel.

Mixpanel allows you to send up to 1,000 SMS/month at no additional cost. If you'd like to send more than 1,000 SMS per month, Mixpanel offers the ability to integrate a Twilio account.

SMS targeting can be based on properties in user profiles, or events that did or did not occur within the last 90 days. For example, if you set a Signup date property, you can create an SMS campaign that only sends to users who signed up over two weeks ago.

Sending phone numbers to Mixpanel

You can only send SMS notifications to users whose profiles have the special $phone property. The value of this property should be the phone number of the user as a string - something like "4805551212". To set this property with the JavaScript library, you can make a call to mixpanel.people.set:

mixpanel.people.set({
    $phone: "4805551212"
});

We support phone numbers for nearly all countries/regions of the world. We do our best to parse the $phone property with respect to the $country_code property (normally determined by the IP address of the request). If no country can be determined from the request, we attempt to parse the number as a US number. If we are unable to parse a valid phone number out of the property you send us, the $phone property will not be set.

Creating an SMS notification

To create a new SMS notification, navigate to the Notifications report and select "SMS Message" from the "Create new notification" dropdown. This will give you the following form:

The SMS consists purely of a message body, and does not support using properties in templates at this time.

Targeting users

When you submit the form, it will ask you to define the targeting criteria for your notification. We're keeping it simple here and restricting the notification to a single user named "Joe Doe". You can use many combinations of profile properties when you're creating a real notification.

Scheduling your SMS campaign

Once you've targeted your users, you just have to schedule the SMS campaign. There are two options for scheduling SMS campaigns:

  • ASAP notifications: These notifications go out to individual users as soon as they match the targeting criteria. It's common for users to go from "not matching" to "matching" - many notifications include a time-based requirement such as "last login was greater than two weeks ago", or one based off of other profile properties that may change.
  • Scheduled notifications: These notifications can be set to go out at a specified time, day of week, and interval. For example, you could set your notification to go out at 9am PST every Wednesday. When the notification runs, it finds all the users who match the criteria you have defined (and who have never received this notification) and sends it to them.