Build a Single Integration for All Your Twilio Data with Event Streams

September 30, 2020
Written by

Event Streams Launch Banner

At the heart of customer engagement, Twilio is radically simplifying how developers can tap into every customer interaction sent or received on our platform with a new API: Event Streams.

With Event Streams, you can consume configurable, centralized streams of data (starting with Messaging, Voice, Super SIM, and TaskRouter events, with all events coming soon) into the system of your choice. At launch, we’re starting with Amazon Kinesis – with more sinks coming soon.

Why did we build Event Streams?

In the last 12 months, the Twilio Customer Engagement Platform has powered nearly one trillion human interactions across all major channels. Humans are generating a massive quantity of digital data — giving you the unprecedented opportunity to better understand and serve your customers. 

However, reliably accessing and tying all of this data together to build a holistic view of what's happening is no small feat. The data that is available is spread out and accessed through different interfaces, using different formats and exposing varying amounts of metadata.

The result? You end up building and managing services to consolidate, transform, and forward data within your systems to make them available to multiple teams and applications.

What is Event Streams?

Event Streams is an API that consolidates data from all Twilio touchpoints, minimizing your integration codebase and overhead. With Event Streams, you can:

  • Stream your data to your existing systems by configuring a modern, persistent streaming technology like Amazon Kinesis (more sinks coming soon)
  • Easily consume and leverage data from multiple Twilio products with consistent metadata, well-defined and versioned schemas, and control over which events you want delivered
  • Trust that your events will be queued if your system goes down and delivered as soon as they’re back up with queuing of event delivery for up to 24 hours

Pierre-Baptiste Béchu, Director of Platform & Infrastructure at Aircall says:

"Event Streams reduces the complexity of our systems by allowing us to easily subscribe to whatever Twilio data we need, with a consistent schema. We're excited for the flexibility and efficiency this gives us in the future as new use cases arise."

How does Event Streams work?

Event Streams evolves event delivery at Twilio beyond a single-producer-to-single-consumer model, giving developers flexibility to create one or multiple subscriptions to stream events to one or multiple sinks. (Twilio will continue to support and develop existing webhooks for TwiML use cases and for customers who prefer per-channel webhook integrations.)

When you create a subscription, you’ll specify what events you want from Twilio based on the event type. Each type of event flowing through Event Streams will have a unique type identifier, organized hierarchically using reverse DNS format. The full type identifier will have the following components:

  • organization: The owning organization that generated the event (e.g., twilio)
  • product group: The overall product group (e.g., taskrouter)
  • resource: The resource within the product group (e.g., task)
  • action: The actual event this type represents (e.g., assigned)

In order for event metadata to be parsed in a consistent way, we'll be using a common "envelope" format. The envelope format will contain common metadata at the top level and will enclose the event payload in a "data" property. The envelope format we're using is CloudEvents, a vendor-agnostic standard being developed by the CNCF serverless group for describing events in a common way.

For example, a Voice Insights Call Summary Predicted Complete event might look like the following:

    "specversion": "1.0",
    "type" : "com.twilio.voice.insights.call-summary.complete",
    "source" : "/v1/Voice/CA00000000000000000000000000000000/Summary",
    "id" : "EZ00000000000000000000000000000000",
    "dataschema": " https://events-schemas.twilio.com/VoiceInsights.CallSummary/1",
    "datacontenttype" : "application/json",
    "time" : "2020-07-23T22:56:33.000Z",
    "data" : {
        "call_sid": "CA00000000000000000000000000000000",
        "account_sid": "CA00000000000000000000000000000000",
        "start_time": "2020-07-23T22:56:28Z",
        "end_time": "2020-07-23T22:56:33Z",
        "duration": 0
        "from": "+15558675309",
        "to": "+16175551213",
        "direction": "outbound-api",
        "caller_name": "Tyler",
        ...

How can I get access to Event Streams?

Event Streams is available to Twilio customers today in Private Beta, free for your first 100,000 events with up to 3 sinks.

For more information, and to sign up to be updated on the product, visit our website.

Jessy Sweet is a Product Marketing Manager at Twilio, working cross-functionally to create marketing strategies and plan product launches on the Twilio platform marketing team. She has dedicated her career to deeply understanding customers, and championing their needs to build the most relevant, valuable, and delightful products and experiences possible.