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
Who
targeting, while user events are used inWhen
targeting.
How to set up the Segment source integration
- From your workspace’s Sources catalog page search for "Command AI" and click Add Source.
- 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.
- Copy the Write Key from the Segment UI. If you are not sure where to find your write key, visit Segment’s articleument.
- Log in to your Command AI account, and navigate to the Segment integration page.
- Paste your Segment Write Key into the text box.
- Click “Connect”.
- [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.
tip
For more details, please refer to Segment’s documentation on setting up a Command AI source.
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!
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
- From the Segment web app, navigate to Connections > Catalog, then select the Destinations tab at the top of the catalog.
- Search for CommandBar and select it.
- Click Configure Command AI.
- Sign in to CommandBar, click on your organization name in the top right, and copy the
Org ID
into Organization ID field. - 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.
- Select an existing Source to connect to Command AI.
For more details, please refer to Segment’s documentation on setting up a Command AI destination.
Using the destination integration
Once installed, the destination integrations allows you to use two Command AI-supported Segment actions:
- Identify user: these are made available for Who targeting.
- Track event: these are made available for When targeting.
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.
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:
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:
Finally, it is possible to create a boolean user property for an event’s name via the special field name user_property_event
:
This example will create the following user property in Command AI:
"extension installed": True