Craft At WillowTree Logo
Content for craftspeople. By the craftspeople at WillowTree.
Salesforce

Salesforce Event Source Accelerator for Segment

The Opportunity

At WillowTree our Growth Marketing Engineers and our Salesforce Engineers frequently work together to build integrations to exchange data between the Salesforce platform and growth marketing platforms such as Braze and Segment. One frequent integration we’ve seen is that while customers want to connect Salesforce to growth marketing tools, there is either no existing solution for the integration, or existing integrations are lacking and don’t meet the business’ needs. The integration requires custom development so that business, technical, and data requirements can be achieved. This can be costly, timely, and a distraction for a customer’s Salesforce engineers and admins who are already quite busy working on competing business needs. Most recently we worked with a customer who was looking to send their customer event data from Salesforce to Segment. They used multiple Salesforce products in support of their customers, including Sales (Leads), Customer Service (Cases), and Field Service. We’ve found that many customers planned to expand their usage of Salesforce over time, so creating an integration that is flexible and can grow as needs change is important.

The Solution

Enter our Salesforce/Segment Accelerator. Our Accelerator is a custom, intuitive Salesforce application that makes the process of sending any Salesforce event data to Segment as easy as defining what to send, how to send it and when to send it. The best part? This all can be setup in Salesforce using clicks-not-code tools familiar to any Salesforce Admin. The “what” and the “how” are set up in a custom mappings object that allows a Salesforce Admin to map an Object and Field in their org to a Segment trait as an Identify, Track or Group call! The “when” to send the data can be simply defined in a flow within Flow Builder. And that’s it!

In addition to creating an easy and intuitive application, another goal for this accelerator was to make it support as many use cases as possible. We wanted it to be flexible enough to support Standard and Custom Objects from all Salesforce Clouds and smart enough to support common Sales Cloud logic like Lead Conversion all without the need for additional metadata deployments.

So how did we build it? One big goal of ours was to create an accelerator that could play well in any Salesforce org regardless of org type, development model, business process, etc (see Our recent experience with Apex Enterprise Patterns blog post for more in-depth discussion on this topic!). With that goal in mind, we avoided any third-party applications and relied solely on Salesforce tooling like Apex (and of course the Test Classes too!), Lightning Web Components (LWCs) and Named Credentials. All of our metadata is namespaced to avoid naming collisions in an org. For debugging, we created a logging solution making it easy to see what data was sent to Segment and what response was returned. Everything we’ve included as a part of this solution was not only make it easy to install in any Salesforce org, but also easy to extend. We understand that every client has its own org structure and business rules so we wanted to make all the code available to enable engineering teams to easily build upon or modify this accelerator.

Putting it all Together

Let’s walk through an example. Jane Doe recently purchased a home security system from WillowTree Home Security and is now awaiting an installation appointment! Sarah is a Salesforce Admin at WillowTree Home Security. Her team has recently been tasked with making sure that Jane’s user in Segment is updated when her Service Appointment has been scheduled. WillowTree Home Security would like to use this event information to send a push notification via Braze to Jane letting her know the details of her installation appointment. Before the Salesforce/Segment Accelerator, this task may have taken a few weeks of custom development to complete. But now, the process takes minutes for Sarah to complete. Using the Salesforce Segment Mappings interface, Sarah can first add the mappings of the fields she would like to send to Segment as a part of this Event.

Next, Sarah uses Flow Builder to create a Flow for the Service Appointment object. She adds simple logic to the Flow to send a specific Event text when the Status of a Service Appointment is set to ‘Scheduled’.

And that’s it! When the Field Service rep updates the Service Appointment for Jane to ‘Scheduled’, the Salesforce/Segment Accelerator uses the Flow data to send the data to Segment as an Event! Expanding the Event details in Segment for Jane’s user shows data from all the fields that were mapped in Salesforce! Sarah’s work is done and she is free to move on to other things!

How does our Accelerator make sense for your business?

If you want to easily send data event data that lives in your Salesforce org to Segment, our solution could be right for you. We’ve done the hard work building and testing the integration to reduce the time it takes to begin sending data to Segment. The accelerator is flexible so that we can evolve it to fit your needs, to make sure everything is set up as required for your business, and your team is equipped to seamlessly integrate, maintain and build upon the solution in your Salesforce orgs.

Interested in learning more about how we can solve your integration challenges between Salesforce and Segment? Contact us today.

Brandon Silva
Frank Evers
Read the Video Transcript
Read the Video Transcript

Recent Articles