Segment

Send user and event data from Segment to Regal Voice

This guide describes how to use Segment to send data to Regal Voice. It discusses how to set up Segment, create and identify users, and track events. You can also refer to Regal Voice's Segment developer documentation here: https://segment.com/docs/connections/destinations/catalog/regal-voice/

Sending Data from Segment to Regal Voice

Get started by enabling the Regal Voice Destination in your Segment.

Enable the Regal Voice Destination

  1. Email [email protected] to get your Regal Voice API Key.
  2. In Segment, navigate to the Sources tab. Open the source from which you'd like to send data to Regal Voice.
  3. Click Add Destination.
  4. From the list of possible destinations, choose Regal Voice.
  5. Click Configure Regal Voice.
  6. Enable the toggle at the top of the Regal Voice integration.
  7. Segment will now send data from the selected source to Regal Voice.

What data to send to Regal Voice

Segment allows you to pass all events to Regal Voice; however, you can also filter out events and only send those that are Relevant to Regal Voice. Events that are relevant include:

  • Identify events - when new users are created or user traits are updated; when optIn for sms and calls is collected. Regal Voice treats optIn as a user trait
  • Track events - related to key moments of the user lifecycle that you wish to reference in your Regal Voice journeys; this can include email send, click, open events
  • Page or screen events - only send these if you wish to reference them in your Regal Voice journeys

Identifying users

Identify events are used to create users and update user properties. If an identify event contains a phone number, Regal Voice will create a contact in your Regal Voice Audience.

Traits in your identify events get added to the contact's profile in Regal Voice. There are a standard set of supported traits including:

  • firstName
  • lastName
  • phone
  • email
  • age
  • gender
  • address
  • optIn

Any other traits you add become custom properties on a contact's profile in Regal Voice.

Here's an example call to Segment's identify method, using their Analytics.js (JavaScript) Source. In this example, custom properties include: salaryBracket, employmentStatus, and savingsGoal

analytics.identify("92980cfccc067", {
  phone: "+19545552399",
  email: "[email protected]",
  firstName: "Rebecca",
  lastName: "Greene",
  age: 23,
  gender: "other",
  address: {
    AddressLine1: "201 Maiden Lane.",
    AddressLine2: "11M",
    City: "New York",
    ZipOrPostcode: "10128",
    StateProvinceCounty: "NY",
    CountryId: "US"
  },
  salaryBracket: "$100k-$500k",
  employmentStatus: "Employed",
  savingsGoal: "New Home"
});

Tracking events

The track call is how you record any actions your users perform, along with any properties that describe the action. We recommend calling track on any event you'd like Regal Voice to use for scoring a lead or as a trigger or condition when sending voice and sms campaigns.

An example for a financial services company might be that you want to tigger an outbound call to a user for whom a ‘Loan Application Approved’ event has been received, but not a ‘Loan Signed’ event (with some parameter around timing).

In that case, an example track call for the ‘Loan Application Approved’ event using Segment's Analytics.js (JavaScript) Source would look like the following:

analytics.track("Loan Application Approved", {
  loanType: "Personal loan", 
  amount: 30000,
  currency: "USD",
  term: 12
})

🚧

Important

The above call does not explicitly include a userId. Segment explains that "In our browser and mobile libraries a User ID is automatically added from the state stored by a previous identify call, so you do not need to add it yourself."

Calling track for a user that doesn't already exist in your Regal Voice project creates a Regal Voice user profile for them and associates it with the custom event data. However, until you call identify for that user with a phone number, their Regal Voice profile is not available in your audience for journeys and messaging. After you've called identify for them, their user profile—along with all previously tracked events—is accessible.

Passing opt in to Regal Voice

In order to trigger outbound calls or sms messages from Regal Voice, you must collect the user’s explicit opt-in for those channels along with the user’s phone number.

There are 2 options for how you can let Regal Voice know a user has opted in:

  1. Anytime you collect opt-in for sms or voice calls, you can trigger a track event after a user opts in and let the Regal Voice team know what track event is synonymous with opt-in collected (there is no required format for this event). The product will then automatically subscribe users who perform that event. (Note: for Regal Voice to subscribe a user, there must already be a phone provided for that user.)

  2. Alternatively, anytime you collect opt-in for sms or voice calls, you can use an identify call to pass that opt-in information to Regal Voice by adding an optIn object like the example above. The example above

Below is an example of what an identify call would look like for a user who opted into multiple channels (sms and voice calls) at once:

analytics.identify("92980cfccc067", {
  phone: +19545552399,
  optIn: [
    {
      channel: "sms",
      subscribed: true,
      timestamp: "2020-08-25T21:23:43Z",
      ip: "172.16.254.1",
      source: "booking_flow",
      text: "By clicking the 'Submit' button below, I agree to receive automated marketing SMS and calls."
    }, 
    {
      channel: "voice",
      subscribed: true,
      timestamp: "2020-08-25T21:23:43Z",
      ip: "172.16.254.1",
      source: "booking_flow",
      text: "By clicking the 'Submit' button below, I agree to receive automated marketing SMS and calls."
  }]
});

Supported messaging channels are sms and voice.

For the identify method, the ip field is required if you are opting in users server side. (If you are opting in users client side, Segment automatically adds ip to the context, so you are not required to add it to the optIn object)

Make sure to include timestamp with the exact time the user opted in. Since traits are cached and sent with subsequent Identify calls, Regal Voice ignores opt-ins that do not have a timestamp date.

Tracking page views

The page and screen call lets you record whenever a user sees a page of your website, along with any optional properties about the page.

Here's an example call to Segment's page method, using their Analytics.js (JavaScript) Source:

analytics.page("Page Category", "Page Name");

Segment notes the following things about the page call:

In analytics.js a page call is included in the snippet by default just after analytics.load. We do that because you must call this method at least once per page load. However, you can choose to add an optional name or properties to the default call, or call it multiple times if you have a single-page application.

Testing your integration

To check the success of your integration:

  • Go to the Recent Activity page in the Regal Voice app to view incoming track and page events
  • Go to the Audience page in the Regal Voice app to view your contacts (created from identify events) - remember in order for a user to appear in your audience they must have a phone. You can also view their optIn status from the Audience page

What’s Next

Once you've finished setting up the Regal Voice Segment Destination, you can set up the Regal Voice Segment Source to receive Regal Voice events back in real-time.

Did this page help you?