Skip to main content

Segment integration

Command AI has a no-code integration with Segment, that allows you to configure Command AI as both a Segment source and destination.

  • Source integration: lets Command AI send event data directly to Segment, which allows you to easily route it to any other tool you have connected to Segment
  • Destination integration: lets Command AI ingest any Segment user attributes and user events, which can then be used for targeting. User attributes are used in Whotargeting, while user events are used in When targeting.

How to set up the Segment source integration

  1. From your workspace’s Sources catalog page search for "Command AI" and click Add Source. Segment add source
  2. On the next screen, give the Source a nickname configure any other settings. The nickname will be used to designate the source in the Segment interface, and Segment will create a related schema name. The schema name is the namespace you’ll be querying against in your warehouse.
  3. Copy the Write Key from the Segment UI. If you are not sure where to find your write key, visit Segment’s articleument.
  4. Log in to your Command AI account, and navigate to the Segment integration page. Segment integration card
  5. Paste your Segment Write Key into the text box.
    Segment write key input
  6. Click “Connect”.
  7. [Optional] Send a test event from the Command AI Segment integration page, and check your Segment Source Debugger to ensure the integration is properly configured.

Testing the source integration

To confirm the integration is working, we recommend sending a test event via the integration page within Command AI here. Click the button "Send test event", and check the Source Debugger within Segment for the test event. If you see it, you are all set!

Segment integration card

What events are sent to Segment?

The events sent to Segment are the same as those captured by addEventSubscriber, which can be found here.

Adding Destinations

Now that your Source is set up, you can connect it with Destinations.

Log into your downstream tools and check to see that your events are populating and they contains all the properties you expect. If all your events and properties are not showing up, refer to the Destination docs for troubleshooting.

How to set up the Segment destination integration

Segment integration card

  1. From the Segment web app, navigate to Connections > Catalog, then select the Destinations tab at the top of the catalog.
  2. Search for CommandBar and select it.
  3. Click Configure Command AI.
  4. Sign in to CommandBar, click on your organization name in the top right, and copy the Org ID into Organization ID field.
  5. If you want to deploy Command AI to your users through Segment, check Deploy via Segment. Please note that we recommend installing Command AI directly rather than through Segment where possible.
  6. Select an existing Source to connect to Command AI.

Using the destination integration

Once installed, the destination integrations allows you to use two Command AI-supported Segment actions:

How to set up the Segment Webhook destination integration

If you don't have Segment installed on your client-side, you can still connect it to Command AI via our Destination Webhook integration. This allows you to use Segment events to set user properties in Command AI.

Warning

Note that events that are sent to Command AI via the Webhook integration can't be used as events in the Command AI sense (for example, used to trigger nudges).

The recommended setup is to add a mapping that sends identify events to our Webhook endpoint:

Segment add source

We will record all of the fields within the traits object as user properties.

Advanced setup

If you wish to limit the fields you send to Command AI or want to record user properties based on other Segment event types like track and page you can make use of a custom mapping configuration. Please make sure that you still include the userId field when setting up a custom mapping. Any event sent to Command AI that does not include a userId is ignored as we have no way to know which end user the event belongs to.

You can use the prefix user_property. to create a user property for any field in your event, even if it’s a track or page event:

Segment add source

Finally, it is possible to create a boolean user property for an event’s name via the special field name user_property_event:

Segment add source

This example will create the following user property in Command AI:

"extension installed": True