> ## Documentation Index
> Fetch the complete documentation index at: https://www.propeldata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Twilio Segment setup guide

> Ingesting events from Twilio Segment to Propel

<div />

This guide covers how to:

1. [Create a Segment Data Pool](#step-1-create-a-segment-data-pool)
2. [Create the Segment webhook destination](#step-2-create-the-segment-webhook-destination)
3. [Preview data in Propel](#step-3-preview-data-in-propel)

***

## Requirements

* You have a [Propel account](https://console.propeldata.com/get-started).
* You have a Segment account.

***

## Step 1: Create a Segment Data Pool

First, create a Segment Data Pool in Propel.

This will give you a dedicated HTTP endpoint for Segment to send events to.

<Tabs>
  <Tab title="Console">
    <Steps>
      <Step title="Navigate to Data Pools">
        In the Console, click on **"Data Pools"** in the left-hand menu. Click on **"Create Data Pool"** and select **"Twilio Segment"**.

        <Frame>
          <img src="https://mintcdn.com/propeldocs/EJuEs6SO8KXtRuWH/images/docs/2024-12-twilio-segment-data-pool-01.png?fit=max&auto=format&n=EJuEs6SO8KXtRuWH&q=85&s=b3fba61fa63fa98cef9aa32aa484ee7c" alt="Creating a new Twilio Segment Data Pool in the Propel Console" width="1479" height="900" data-path="images/docs/2024-12-twilio-segment-data-pool-01.png" />
        </Frame>
      </Step>

      <Step title="Define the schema">
        The default schema contains two columns:

        | Column                | Type      | Description                                        |
        | --------------------- | --------- | -------------------------------------------------- |
        | `_propel_received_at` | TIMESTAMP | The timestamp when the event was collected in UTC. |
        | `_propel_payload`     | JSON      | The value in the `records[i].data` of the event.   |

        On the right, you'll see a sample Segment event.

        <Frame>
          <img src="https://mintcdn.com/propeldocs/EJuEs6SO8KXtRuWH/images/docs/2024-12-twilio-segment-data-pool-02.png?fit=max&auto=format&n=EJuEs6SO8KXtRuWH&q=85&s=9300f511e0b8984224b42a9845744454" alt="Defining the schema for a Twilio Segment Data Pool" width="1482" height="1073" data-path="images/docs/2024-12-twilio-segment-data-pool-02.png" />
        </Frame>

        With the sample event or your own, you can:

        * **Extract top-level properties** to create columns representing the top-level keys.
        * **Extract nested properties** to create columns representing the nested JSON keys.

        <Warning>
          If a required field is missing from the sample event, Propel will reject the event with an `HTTP 400 Bad Request` error.
        </Warning>
      </Step>

      <Step title="Configure Authentication">
        You can enable basic authentication to secure your endpoint.

        After configuring, click **"Next"** to proceed.

        <Frame>
          <img src="https://mintcdn.com/propeldocs/EJuEs6SO8KXtRuWH/images/docs/2024-12-twilio-segment-data-pool-03.png?fit=max&auto=format&n=EJuEs6SO8KXtRuWH&q=85&s=d07937c4bc3dd55333b0e0423447fce6" alt="Configuring authentication settings for a Twilio Segment Data Pool" width="1482" height="527" data-path="images/docs/2024-12-twilio-segment-data-pool-03.png" />
        </Frame>
      </Step>

      <Step title="Configure the table settings">
        Select **"Append-only"**.

        To learn more, read out guide on [Selecting table engine and sorting key](/docs/guides/table-engine-and-sorting-key).

        <Frame>
          <img src="https://mintcdn.com/propeldocs/EJuEs6SO8KXtRuWH/images/docs/2024-12-twilio-segment-data-pool-04.png?fit=max&auto=format&n=EJuEs6SO8KXtRuWH&q=85&s=4e3dc78bc7c9efed3c15ec9ae44cb9a9" alt="Selecting table settings for a Twilio Segment Data Pool" width="1499" height="524" data-path="images/docs/2024-12-twilio-segment-data-pool-04.png" />
        </Frame>

        Answer the questions in the wizard to complete the setup.

        <Frame>
          <img src="https://mintcdn.com/propeldocs/EJuEs6SO8KXtRuWH/images/docs/2024-12-twilio-segment-data-pool-05.png?fit=max&auto=format&n=EJuEs6SO8KXtRuWH&q=85&s=a343485f91ed1ddde72f11dba8e7e178" alt="Completing the table settings wizard for a Twilio Segment Data Pool" width="1482" height="598" data-path="images/docs/2024-12-twilio-segment-data-pool-05.png" />
        </Frame>

        Confirm your table settings and click **"Continue"**.

        <Frame>
          <img src="https://mintcdn.com/propeldocs/EJuEs6SO8KXtRuWH/images/docs/2024-12-twilio-segment-data-pool-06.png?fit=max&auto=format&n=EJuEs6SO8KXtRuWH&q=85&s=cfd4ee0a091f715e7733cd7f4d77f9fb" alt="Confirming table settings for a Twilio Segment Data Pool" width="1482" height="869" data-path="images/docs/2024-12-twilio-segment-data-pool-06.png" />
        </Frame>
      </Step>

      <Step title="Set a name and description">
        Enter a name and description for your new Data Pool and click **"Next"**.

        <Frame>
          <img src="https://mintcdn.com/propeldocs/EJuEs6SO8KXtRuWH/images/docs/2024-12-twilio-segment-data-pool-07.png?fit=max&auto=format&n=EJuEs6SO8KXtRuWH&q=85&s=da253afe4529dd067a2a473016729b17" alt="Setting name and description for a Twilio Segment Data Pool" width="1482" height="585" data-path="images/docs/2024-12-twilio-segment-data-pool-07.png" />
        </Frame>

        After creating the Data Pool, you'll be provided with a unique HTTP endpoint.

        You'll need this endpoint and key to configure your Segment webhook destination.

        <Frame>
          <img src="https://mintcdn.com/propeldocs/EJuEs6SO8KXtRuWH/images/docs/2024-12-twilio-segment-data-pool-08.png?fit=max&auto=format&n=EJuEs6SO8KXtRuWH&q=85&s=6a14776148a62f336dc5e0fee53b4eb9" alt="Viewing the created Twilio Segment Data Pool details" width="1499" height="915" data-path="images/docs/2024-12-twilio-segment-data-pool-08.png" />
        </Frame>
      </Step>
    </Steps>
  </Tab>

  <Tab title="API">
    For the Twilio Segment Data Pool, creating the Data Source below automatically creates the Data Pool.

    ```graphql theme={"system"}
    mutation {
      createTwilioSegmentDataSource(input: {
        uniqueName: "my_twilio_segment_data_pool"
        description:"My Twilio Segment Data Pool"
        connectionSettings: {
          basicAuth: {
            username: "<YOUR_USERNAME>"
            password: "<YOUR_PASSWORD>"
          }
          columns: [
            { name: "properties", jsonProperty: "properties", type: JSON, nullable: true },
            { name: "messageId", jsonProperty: "messageId", type: STRING, nullable: true },
            { name: "receivedAt", jsonProperty: "receivedAt", type: TIMESTAMP, nullable: true },
            { name: "event", jsonProperty: "event", type: STRING, nullable: true },
            { name: "traits", jsonProperty: "traits", type: JSON, nullable: true },
            { name: "context", jsonProperty: "context", type: JSON, nullable: true },
            { name: "sentAt", jsonProperty: "sentAt", type: TIMESTAMP, nullable: true },
            { name: "timestamp", jsonProperty: "timestamp", type: TIMESTAMP, nullable: true },
            { name: "anonymousId", jsonProperty: "anonymousId", type: STRING, nullable: true },
            { name: "type", jsonProperty: "type", type: STRING, nullable: true }
          ]
          accessControlEnabled: true,
          tableSettings: {
            engine: {
              mergeTree: {
                type: MERGE_TREE
              }
            }
            orderBy: ["sentAt"],
          }
        }

      }){
        dataSource {
          id
          uniqueName
          status
          type
          connectionSettings {
            ... on TwilioSegmentConnectionSettings {
              httpEndpointURL
            }
          }
        }
      }
    }
    ```
  </Tab>
</Tabs>

***

## Step 2: Create the Segment webhook destination

Once you have the Data Pool created, we'll need to create a Segment webhook destination that sends events to Propel.

<Steps>
  <Step title="Go to the 'Destinations' section of your Segment workspace">
    Once you are in the **"Destinations"** section of your Segment workspace, click on **"Create Destination"**.

    <Frame>
      <img src="https://mintcdn.com/propeldocs/EJuEs6SO8KXtRuWH/images/docs/2024-12-segment-setup-01.png?fit=max&auto=format&n=EJuEs6SO8KXtRuWH&q=85&s=2ad9fbe0593ab82a736c247a93928e30" alt="Creating a new Firehose stream in AWS console" width="1479" height="943" data-path="images/docs/2024-12-segment-setup-01.png" />
    </Frame>
  </Step>

  <Step title="Search and select Webhooks">
    Search for **"Webhooks"** and select it.

    <Frame>
      <img src="https://mintcdn.com/propeldocs/EJuEs6SO8KXtRuWH/images/docs/2024-12-segment-setup-02.png?fit=max&auto=format&n=EJuEs6SO8KXtRuWH&q=85&s=4ec19fe6b1f85e13c73f9c90ef004f76" alt="Selecting Webhooks as the destination" width="1479" height="943" data-path="images/docs/2024-12-segment-setup-02.png" />
    </Frame>

    Click **"Add Destination"**.

    <Frame>
      <img src="https://mintcdn.com/propeldocs/EJuEs6SO8KXtRuWH/images/docs/2024-12-segment-setup-03.png?fit=max&auto=format&n=EJuEs6SO8KXtRuWH&q=85&s=2e2cb3dcfa50626af9ee6988492ed9ce" alt="Adding the Webhooks destination" width="1479" height="943" data-path="images/docs/2024-12-segment-setup-03.png" />
    </Frame>
  </Step>

  <Step title="Select a source for the destination">
    Select the source you want to send events to and click **"Next"**.

    <Frame>
      <img src="https://mintcdn.com/propeldocs/EJuEs6SO8KXtRuWH/images/docs/2024-12-segment-setup-04.png?fit=max&auto=format&n=EJuEs6SO8KXtRuWH&q=85&s=d7eefae7652bc4a02ebe05bac519aca5" alt="Selecting a source for the Webhooks destination" width="1479" height="943" data-path="images/docs/2024-12-segment-setup-04.png" />
    </Frame>
  </Step>

  <Step title="Give the destination a name and create it">
    Name your destination "Propel", then click **"Create destination"**.

    <Frame>
      <img src="https://mintcdn.com/propeldocs/EJuEs6SO8KXtRuWH/images/docs/2024-12-segment-setup-05.png?fit=max&auto=format&n=EJuEs6SO8KXtRuWH&q=85&s=4e6139cf63d1830fcb0d655bd650a84f" alt="Naming the Webhooks destination" width="1479" height="943" data-path="images/docs/2024-12-segment-setup-05.png" />
    </Frame>
  </Step>

  <Step title="Create a mapping">
    Click **"Mappings"** tab and click **"New mapping"**.

    <Frame>
      <img src="https://mintcdn.com/propeldocs/EJuEs6SO8KXtRuWH/images/docs/2024-12-segment-setup-06.png?fit=max&auto=format&n=EJuEs6SO8KXtRuWH&q=85&s=a6467d4d13b6503f28b19f43b5058b6d" alt="Creating a mapping for the Webhooks destination" width="1479" height="921" data-path="images/docs/2024-12-segment-setup-06.png" />
    </Frame>

    Select the **"Send an HTTP request"** action, define the event trigger, and load a sample event. You'll need the sample event to test your destination.

    <Frame>
      <img src="https://mintcdn.com/propeldocs/EJuEs6SO8KXtRuWH/images/docs/2024-12-segment-setup-07.png?fit=max&auto=format&n=EJuEs6SO8KXtRuWH&q=85&s=748337092fbe5bc92d24a8c55c2d43d4" alt="Defining the event trigger for the Webhooks destination" width="1479" height="941" data-path="images/docs/2024-12-segment-setup-07.png" />
    </Frame>

    Enter your Segment Data Pool HTTP endpoint, "POST" as the method, and select batching of 500 events.

    <Frame>
      <img src="https://mintcdn.com/propeldocs/EJuEs6SO8KXtRuWH/images/docs/2024-12-segment-setup-08.png?fit=max&auto=format&n=EJuEs6SO8KXtRuWH&q=85&s=0bfd4218308c824088b3b5ddad5082a2" alt="Defining the event trigger for the Webhooks destination" width="1482" height="1113" data-path="images/docs/2024-12-segment-setup-08.png" />
    </Frame>

    Finally, to test your destination, click **"Send test event"**.

    <Frame>
      <img src="https://mintcdn.com/propeldocs/EJuEs6SO8KXtRuWH/images/docs/2024-12-segment-setup-09.png?fit=max&auto=format&n=EJuEs6SO8KXtRuWH&q=85&s=069e073f53386867543e12be391fdf3e" alt="Testing the Webhooks destination" width="1499" height="1141" data-path="images/docs/2024-12-segment-setup-09.png" />
    </Frame>
  </Step>
</Steps>

***

## Step 3: Preview data in Propel

Once events are in your Segment webhook destination, they are ingested directly to Propel.

By going to your Data Pool and clicking **"Preview Data"**, you'll be able to see the records as they land.

<Frame>
  <img src="https://mintlify.s3.us-west-1.amazonaws.com/propeldocs/images/docs/2024-12-twilio-segment-data-pool-09.png" alt="Previewing ingested data in the Propel Console" />
</Frame>
