# Segment

### Connection <a href="#connect" id="connect"></a>

When you're setting up your first workflow with Segment, you'll need to add your Write Key so that your Segment "Source" is a connected app within MESA.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FBsYWfveRf9s8kQkGnFAf%2Fimage.png?alt=media&#x26;token=9f6fd674-3be3-454d-89f3-8bb11c18d4e9" alt=""><figcaption></figcaption></figure>

First, you will need to set up your Source for MESA to send to. The easiest Source type to use would be the [**HTTP Tracking API Source**](https://segment.com/docs/connections/sources/catalog/libraries/server/http-api/).

After the Source is set up, you will have to locate the Write Key for posting to that Source. It can be [found on the settings tab](https://segment.com/docs/connections/find-writekey/) or when you first create your Source.

1\. From the Segment dashboard, locate the Source under Sources (left hand side bar).

2\. Click on Settings and then API Keys. Click on the Copy button next to the Write Key.

3\. Paste the Write Key into your MESA workflow's Segment Action and click on Add Connection. Then, you are all set!

### Configure <a href="#configuring" id="configuring"></a>

#### How to send data from Segment to MESA <a href="#sendfromsegment" id="sendfromsegment"></a>

In order to send Segment data to MESA, first set up a new MESA Workflow, with the trigger as [Webhook](https://docs.getmesa.com/tools/webhook).

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FlI1JCbKf3DNgYQEypw81%2FEF-segment-webhook.png%20-%20Step%202%20(1).png?alt=media&#x26;token=15dbd201-b0a8-4759-ba99-acd86f5a0d42" alt=""><figcaption></figcaption></figure>

Copy the Host field value from the MESA Trigger and navigate to the Segment dashboard to create a new [Webhooks](https://segment.com/docs/connections/destinations/catalog/webhooks/) Destinatio&#x6E;**.**

Click into Destinations and choose the Webhook Destination you just created, then navigate to the Mappings tab.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FzSZWDti2FFbBIo0EilJ7%2FEF-segment-destinations-mapping.png%20-%20Step%202.png?alt=media&#x26;token=007dbc9f-41dc-4e92-a516-a488398e5fd0" alt=""><figcaption></figcaption></figure>

Once you are inside the mapping, you should see this field to enter the URL for the Webhook.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FmD75WqXbN3i3xGwF28DI%2FEF-segment-destinations-mapping-URL.png%20-%20Step%202.png?alt=media&#x26;token=8cb89a40-6906-49ba-9333-41da89c0d7f5" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.getmesa.com/connect/segment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
