How to set up the Segment integration

In this guide you’ll learn how to set up a Segment integration and add conversational data to your analytics stack.

Create a source

In Segment, a source represents a website or app that you want to track. Sources send data into Segment, while destinations receive data from Segment.

Let’s create a source and connect it to your app.

  1. In Segment, click Catalog, then search for HTTP API in the search box. Click on HTTP API when the search result appears.
  1. In the pop-up window, click Add Source.

  2. Give the source a descriptive name, such as Meya.


Click Add Source.

A new screen will appear with your source’s Write Key. Make a note of this value. Leave this tab open in your browser since you’ll come back here to test the connection.

You can always access the Write Key by opening the source, choosing the Settings tab, then selecting API Keys from the left-hand menu:


Create the integration

Now that you have your Segment write key, you’re ready to add the integration to your app.

  1. In your app’s root folder, create a file called vault.yaml, if it doesn’t already exist, and add the following line:
segment.write_key: xxx


Do not place your actual write key in this file. The vault.yaml file tells developers what private data they need to include in vault.secret.yaml.

Save the file.

  1. In your app’s root folder, create a file called vault.secret.yaml, if it doesn’t already exist, and add this:
segment.write_key: WRITE_KEY


Make sure to replace WRITE_KEY with your source’s write key you generated in the previous section.

Upload the new secrets to your vault by running this command in your terminal:

meya vault upload --file vault.secret.yaml
  1. In your app’s root folder, create a folder called integrations, if it doesn’t already exist. Inside, create a file called segment.yaml. Copy this code into the file:
type: meya.segment.integration
write_key: (@ vault.segment.write_key )

Save the file, then run these commands in your terminal to push your changes to the Grid:

meya format
meya push

Test the integration

  1. Go to your new source’s page in Segment. Click the Debugger tab.
  1. Open the Meya console in your browser and go to the Simulator tab. Enter any text, then check the Segment debugger. You should see at least one event come in.


You now have an integration with Segment and are ready to start connecting your source to any number of destinations!