---
title: "Segment Integration Toolkit"
slug: "segment-integration-toolkit"
description: "Learn the basics of how the Segment Source integration works. Visit Gladly Help Docs to learn more."
updated: 2025-01-16T06:43:43Z
published: 2025-01-30T20:02:03Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://help.gladly.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Segment Integration Toolkit

Learn the basics of how the Segment Source integration works.

## **Who maintains the integration**

The Segment Source integration is built and maintained by Gladly.

## **Basic scope**

As a push-based integration, Gladly sends Customer, Conversation, Agent, and Topic data to Segment whenever a Conversation is opened or closed. Once configured, data is automatically sent to Segment whenever a Conversation is opened or closed. The data is sent to Segment as a track event, which can later be used for segmentation or data routing.

## **How the integration works**

Once the Segment Source integration is connected to Gladly, the following details are sent to Segment.

**Conversation Created**

| Field Name | Value |
| --- | --- |
| event | “Gladly Conversation Created” |
| userId | Customer’s ID |
| timestamp | Conversation Created Timestamp |
| agentId | Agent’s ID currently assigned to Conversation |
| agentName | Agent’s Name currently assigned to Conversation |
| customerName | Customer’s Full Name |
| conversationId | Conversation’s ID |
| customerAttributes | Customer’s Custom Attributes |
| email | Customer’s Primary Email Address or 1st Email Address if no Primary is selected |
| phone | Customer’s Primary Phone Number in E.164 format or 1st Phone Number if no Primary is selected |
| status | Conversation’s Status |

**JSON**

```json
{
  "context": {
    "library": {
      "name": "unknown",
      "version": "unknown"
    }
  },
  "event": "Gladly Conversation Created",
  "integrations": {},
  "messageId": "<Segment Message ID>",
  "originalTimestamp": "2022-07-08T18:46:37.946Z",
  "properties": {
    "agentId": "<Gladly Agent ID>",
    "agentName": "<Gladly Agent Name>",
    "conversationId": "<Gladly Conversation ID>",
    "customerName" : "<Gladly Customer Name>",
    "email": "<Gladly Customer Primary Email>",
    "phone": "<Gladly Customer Primary Phone>",
		"customAttributes": {
			"example": "<Customer Custom Attribute>"
		},
    "status": "OPEN",
  },
  "receivedAt": "2022-07-08T18:46:38.486Z",
  "timestamp": "2022-07-08T18:46:37.946Z",
  "type": "track",
  "userId": "<Glaldy Customer ID>"
}
```

You can validate Conversations are in Segment by selecting your Segment Source and clicking the Debugger tab.

![Debugger interface showing conversation events with timestamps and properties for tracking.](https://cdn.us.document360.io/7047b671-c4f2-4df0-bb0a-b9b511fd2452/Images/Documentation/segment-gladly-source.png)

**Conversation Closed**

Multiple Conversation Closed events may be sent for the same Conversation ID if the Conversation was reopened and closed.

A Conversation Closed event may not be emitted for all Conversations. For example, if a Conversation was Created and the Customer Profile was deleted before closing, the Conversation Closed event will not trigger.

| **Field Name** | **Value** |
| --- | --- |
| event | “Gladly Conversation Closed” |
| userId | Customer’s ID |
| timestamp | Conversation Created Timestamp |
| agentId | Agent’s ID currently assigned to Conversation |
| agentName | Agent's Name currently assigned to Conversation |
| customerName | Customer's Full Name |
| conversationId | Conversation's ID |
| customAttributes | Customer's Custom Attributes |
| email | Customer’s Primary Email Address or 1st Email Address if no Primary is selected |
| phone | Customer’s Primary Phone Number in E.164 format or 1st Phone Number if no Primary is selected |
| status | Conversation's Status |
| topicIds | List of the Conversation Topic IDs |

**JSON**

```json
{
  "context": {
    "library": {
      "name": "unknown",
      "version": "unknown"
    }
  },
  "event": "Gladly Conversation Closed",
  "integrations": {},
  "messageId": "<Segment Message ID>",
  "originalTimestamp": "2022-07-08T18:46:37.946Z",
  "properties": {
    "agentId": "<Gladly Agent ID>",
    "agentName": "<Gladly Agent Name>",
    "conversationId": "<Gladly Conversation ID>",
    "customerName" : "<Gladly Customer Name>",
    "email": "<Gladly Customer Primary Email>",
    "phone": "<Gladly Customer Primary Phone>",
		"customAttributes": {
			"example": "<Customer Custom Attribute>"
		},
    "status": "CLOSED",
    "topicIds": ["<Gladly Topic ID>"]
  },
  "receivedAt": "2022-07-08T18:46:38.486Z",
  "timestamp": "2022-07-08T18:46:37.946Z",
  "type": "track",
  "userId": "<Glaldy Customer ID>"
}
```

![Debugger interface showing conversation tracking events and their timestamps.](https://cdn.us.document360.io/7047b671-c4f2-4df0-bb0a-b9b511fd2452/Images/Documentation/segment-gladly-source-closed.png)
