Introducing Functions: Ship your ideas faster

Sep 24, 2019

By Madelyn Mullen

In less than ten years, the ecosystem of marketing and analytics tools has grown nearly 50x. As a result, our customers are adopting a larger mix of best-in-breed tools within the Segment catalog to unlock new, creative applications of customer data. But as new use cases and tools arise, they are left with the difficult choice of spending valuable resources on new integrations or missing out on powerful applications.

Today we’re introducing Functions—a new way to solve more use cases and connect more tools to Segment with just a few lines of JavaScript. With Functions, you can bring new types of data into Segment, enrich data in transit, and send data to new types of destinations. Functions is now in developer preview and you can request access here.

Say hello to infinite integrations

The Segment catalog today has 300+ integrations to help you activate your first-party data in the tools you use every day. And now, for the first time, infinite integrations are possible. Functions offer a way to create custom sources and custom destinations directly within your Segment workspace.

  • Custom sources help you collect your first-party customer data across any data source. See the docs →

  • Custom destinations allow you send customer events—like completing an order, entering an audience, or interacting with a marketing campaign—to your favorite tools or internal services. See the docs →

These custom integration options make Segment the most extensible and reliable infrastructure for your customer data, and enable you to use Segment to capture all of your customer-facing interactions. You can rest assured that the custom sources and destinations you build with Functions are:

  • Fast: Don’t require engineering resources to maintain infrastructure—80% of early beta participants get Functions built and deployed in the same day

  • Simple: Takes less than ten lines of (serverless) code for many Functions and zero time configuring networks, gateways, and IAM

  • Scalable: Each function supports hundreds of thousands of events per second with built-in monitoring and alerting—all backed by our API-first approach

    asset JVEEAoC1pR7RZGAR

Capture value across all of your customer data sources

In order to adapt quickly, your business needs a complete set of customer data flowing into each of your marketing and analytics tools. Functions help you get the right data into Segment by transforming webhooks generated from any tool or service to the Segment spec as a custom source.

For instance, you can use Functions to unlock first-party data from tools that exist outside the Segment catalog, like Typeform, Pipedrive, and Shopify. But that’s not all. Here are just a few things you can do with Functions, inspired by our early beta participants:

  • Start an onboarding campaign in your email marketing tool when a customer opportunity is marked “Closed Won” in your sales crm

  • Create a life-time value (LTV)computed trait using subscription data from your data warehouse to prioritize ad spend in your advertising tool

  • Combine mobile revenue with web revenues across multiple properties from your payment service for tailored product offerings in your e-commerce platform

You can build a custom source using one of our pre-built templates, writing your own, or by using the handy webhook event catcher to get you started.

asset Z2gmvvkrC6QRwsHw

No matter your preference, the Functions editor helps you along with Typewriter—our powerful autocomplete and spec spell check tool—so that you can capture, transform, and send data into Segment with confidence.

asset ZDxGG0EKyfub0A0J

By combining our existing sources and libraries and your own custom sources, your customer data collection becomes streamlined, trusted, and actionable across every team in your organization. 

Create dream customer experiences with custom destinations

You can also use Functions to create custom destinations that transform and map events collected by Segment to other APIs, tools, and services. Here’s how some of our early beta participants have used custom destinations to unlock new use cases:

  • Trigger notifications in your messaging platform on important events like Signed Up or

    Order Placed

  • Sync subscription information in your data warehouse by sending events like Subscription Started, Subscription Updated and Subscription Removed

  • Send out a user survey on in your customer experience platform when a user uninstalls your app based on anApp Uninstalled event fired

In just minutes, you can combine your Segment data with your own internal applications and services, as well as tools like Follow Along, RequestBin, Airtable, and more. Just like custom sources, you can use the Functions editor to create a custom destination—either starting from scratch or by modifying a pre-built template.

s 4959131A93E1958F4B048E811849FBEB9DEB6979F50C5954355633571A8DAB9D 1568835000919 carbon

No matter your approach, you can configure exactly how your Segment events and objects get sent to your downstream tool or service. If you’d like to enrich an event, you can look up identity details with Personas or bring in data from your other cloud application source.

When you build a custom destination, you can take advantage of existing developer features in Segment, including destination filters, notifications, visibility, retries, and data replay—no additional infrastructure required.

What would you like to build first?

Early beta participants have already saved weeks, and even months, of engineering time by bringing new types of data into Segment and building incredible customized experiences with Functions.  Here are a few highlights:

Test for product market fit using survey data tied to product usage. At Ailo, the product team wants to move fast to collect and respond to critical customer feedback as they build out their property management platform. Functions helped them build out a survey with a custom source for Typeform, combined the response data with SQL traits generated through Personas, and sent that complete view of the customer to a custom destination that extended Mixpanel capabilities.  Adapt existing tools for marketing campaigns and support programs. At, the marketing team uses Functions to accelerate their journey of creating a single customer view across all key channels—website, email, and support. Custom sources allow them to unify web, Mandrill, and Zendesk details to deliver relevant and effective customer email campaigns. Bring key customer events to life in the office. When good things happen for their customers, the team at visitor management app OnSide Technology wants to know. They created a custom destination using a Segment event so that every time a visitor checks in or out of an Onside managed property using their app, funky lights trigger in the office. What event could you use to trigger lights that could motivate your office? Many customers like Franksmile and Nordgreen, and solutions partners like Funnel Ventures and Juan Gonzalez, have used Functions for more than just saving engineering hours. Additional savings included the time not required going through vendor reviews, signing contracts, and on-boarding new tools. 

Are you ready to join great engineering, product, and data science teams using Functions to build a new source or destination or adapt existing ones for your workspace? Click here to request access to the developer preview for Functions. We can’t wait to learn about the experiences you’ll build for your customers with Segment! 

Or to learn more about how Functions works, read the docs for custom sources and custom destinations.

The State of Personalization 2023

Our annual look at how attitudes, preferences, and experiences with personalization have evolved over the past year.

Get the report
SOP 2023

The State of Personalization 2023

Our annual look at how attitudes, preferences, and experiences with personalization have evolved over the past year.

Get the report
SOP 2023

Share article

Want to keep updated on Segment launches, events, and updates?

We’ll share a copy of this guide and send you content and updates about Twilio Segment’s products as we continue to build the world’s leading CDP. We use your information according to our privacy policy. You can update your preferences at any time.