Segment as an action is very useful for companies that use Segment as a CDP (Customer Data Platform). For example, a company might be tracking web events with Segment and sending its transactional data into Segment, to then funnel that data into different business applications.

With this Action Datagran customers can send the output of Pipelines containing Machine Learning models into Segment. The inputs required by this Action are the following:

  1. Write Key: Is an API Key that will allow Datagran to send data via the Segment's REST API. For instructions on how to get the Write Key go here.

  2. Table: It refers to the table that you want to extract data from. Datagran will automatically detect your table once you connect the Segment Action to the specific operator (usually a SQL operator).

  3. Event name: Refers to the event that will hold your properties. For example an event could be "Sales Predictions".

  4. Properties: Refers to the properties contained in an event. You can have as many properties as you want.

  5. Customer id: Refers to the customer ID in your database. If the user exists in Segment we will update the event and properties. If not, we will create a new customer.

A simplified pipeline example with a Segment Action would look like this:

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/cbb77f85-3310-4f92-8dca-2f59d534e757/Screen_Shot_2021-05-14_at_4.11.01_PM.png

To be able to use Segment as an Action, you will need to create an HTTP Source in your Segment Dashboard. It should look something like this:

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/696f357b-f8ac-4abe-85ef-d8c59f6aeb10/image_(63).png

The output that Segment will get will be something like this:

analytics.track('162514333', 'Sales Prediction', {
	'iphone': '0.734', 
	'apple_watch': '0.812'
})

As mentioned before this method has a user_id string, an event string and a properties string.