> For the complete documentation index, see [llms.txt](https://docs.getmesa.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.getmesa.com/connect/segment.md).

# 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="/files/ieEiW7cp4XhmlDUFsvII" 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](/tools/webhook.md).

<figure><img src="/files/vHAFHR75jJPOXJpg5daB" 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="/files/zds7Lkln4eSB3j370Plh" 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="/files/avIObWFm7oApwTFIHexe" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
