In June, Twilio announced CustomerAI - bringing the power of large language models (LLMs) with the rich customer data that flows through Twilio’s Customer Engagement Platform to help companies unlock the potential of their customers.
Today, we’re excited to introduce a new set of skills for CustomerAI – the ability to connect your data to thousands of integrations, based on natural language. CustomerAI will now write the code for new integrations based on a high-level description and requirements, turning what would have previously been weeks of integration coding into a 3-sentence prompt.
But that’s not all. CustomerAI will also make the process of maintaining your code easier with its new Functions Analyzer capabilities. Functions Analyzer summarizes your code and extracts a simple description of what it does, reducing the “cold-start” problem for new developers to be able to contribute and maintain functions.
Segment Functions <3 CustomerAI
Since introducing Functions, we have seen developers push the bounds of what was possible with customer data. Segment Functions processes 40+ billion messages across 4,000 functions every month, and the number is growing every day. Our developer friends find it so easy to write and deploy the codes to bring and activate the data.
Functions unlock all kinds of advanced use cases: integrations, enrichment, filtration - you name it! However, they require code, and not everyone can (or wants!) to write code. So we asked ourselves, what would it look like if you gave the flexibility and scale of serverless functions to everyone within an organization using CustomerAI?
How is CustomerAI helping Segment Functions?
When working with Functions, there are two common challenges we’ve come across:
Translating logic into code - a developer understands what the requirements are, translates those needs into code, and considers non-functional requirements like, "how many retries should this system attempt?"
Maintaining code across a large team - inheriting another developer’s code can be a puzzle in itself. Some Functions can be hundreds of lines of code. And when that code was written by someone else who’s not next to you anymore; you’re tempted to abandon them and re-write the new ones.
As a developer-first company, we realize the best code can sometimes be the code you never have to write and maintain.
So today we’re introducing Functions Writer and Functions Analyzer.
Prompt Used (Input to OpenAI Codex):
A function that is used to send requests to Amazon DSP. It first checks if an access token exists, and if not, it fetches one using a refresh token. It then sends a request to Amazon DSP, and if the access token is expired, it will attempt to refresh it and retry the request up to 3 times. If the request fails after 3 attempts, it will throw an error.
Functions Analyzer is your AI-powered copilot to simplify code maintenance. When prompted, Functions Analyzer analyzes your code and generates a clear summary of its functionality and areas for optimization. Imagine having a second set of eyes that not only understands your code but also suggests optimizations, ensuring every line you write is efficient and cost-effective. The result? Quicker function builds, simpler code management, and significant savings in computation time and costs.
Analysis from Functions Analyzer (Output from OpenAI Codex):
The above code is an asynchronous function that is used to send a request to Amazon DSP. It first checks if the access token is expired, and if so, it refreshes the token using the refresh token. It then sends the request to Amazon DSP, and if the request fails, it will retry up to 3 times. If the access token is expired, it will retry up to 3 times.
The isAccessTokenExpired() function checks if the response status is 401, which indicates that the access token is expired.
The isRetriable() function checks if the response status is 429 or greater than 500, which indicates that the request should be tried.
The fetchAccessTokenUsingRefreshToken() function uses the refresh token to get a new access token. It retires the request up to 3 times if the response is not successful.
The sendRequestToAmazonDSP() function sends a request to Amazon DSP using the access token. It retires the request up to 3 times if the response is not successful. If the response indicates that the access token has expired, it will attempt to refresh the access token and retry the request.
The onIdentify() function is the main function that is called when the class is invoked. It fetches the external IDs from Personas, checks if any of them are IDFAs and if so, sends a request to Amazon DSP to add or remove the user from the audience.
Ensuring Trust in CustomerAI
While aiming for the correctness in code through the insights gathered from your workspace, we treat your customer data privacy with the utmost importance. To do so, we are building CustomerAI products based on the fundamental principles of Transparency, Responsibility and Accountability. Moreover, our AI nutrition facts aim to give consumers and businesses a more transparent and clear view into ‘what's in the box’ for our CustomerAI products, especially around how their data is being used.
In a future blog post, we will dive deeper into the ‘Trust’ layer of CustomerAI. We are excited to share our journey to earn trust on CustomerAI from consumers and businesses soon. Stay tuned!
Ready to get your hands on it?
We will be introducing Functions Writer & Functions Analyzer in pilot over the coming weeks. We're eager to gather feedback to make these features as intuitive and effective as possible. Your insights will play a pivotal role in training our models to be contextually aware and precise.
Looking ahead, we’re excited about the ways in which CustomerAI will change the game for customer data. We’ll be introducing more capabilities that empower developers and data teams to bring more value out of their customer data quickly and safely. Great customer engagement depends on great customer data, and CustomerAI is emerging as a powerful tool to collect, unify, and activate customer data.
Interested in becoming the first developer supercharging the customer data with the Segment Functions and CustomerAI? Schedule a demo now.
Segment + Wilco: The Quest for better learning options
Introducing Wilco - a platform for hands-on tech learning with real-world simulations. It encourages readers to try Wilco for free.
Extensibility at Segment: Use Mobile Plugins to enable Location-aware Marketing
Follow OwlEats, a food delivery startup, that uses Segment's mobile plugins to seamlessly integrate location data, enhancing customer targeting and incentivizing in-store pickups.
3 things we learned at CDP Week 2023: AI Edition
At CDP Week 2023, we looked at how AI trends are shaping customer experiences. Here's the recap.