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

# NSChatSession

> Use the ChatSessionEntity on the Chat agent instead. Chat sessions belong to a chat topic, and contain messages to/from users. Carrier object for ChatSession.

Use the ChatSessionEntity on the Chat agent instead. Chat sessions belong to a chat topic, and contain messages to/from users. Carrier object for ChatSession.

## Constructors

### NSChatSession()

```crmscript theme={null}
NSChatSession
```

Initializes a new instance of the NSChatSession class.

## Methods

## GetChatSessionId()

```crmscript theme={null}
Integer GetChatSessionId()
```

**Returns:** [CRMScript.Global.Integer](CRMScript.Global.Integer) - The primary key (auto-incremented).

**Example:**

```crmscript theme={null}
NSChatSession thing;
Integer chatSessionId = thing.GetChatSessionId();
```

## SetChatSessionId(Integer)

```crmscript theme={null}
Void SetChatSessionId(Integer chatSessionId)
```

**Returns:** [CRMScript.Global.Void](CRMScript.Global.Void)

**Example:**

```crmscript theme={null}
NSChatSession thing;
Integer chatSessionId;
thing.SetChatSessionId(chatSessionId);
```


## Related topics

- [Namespace CRMScript.NetServer](/en/automation/crmscript/reference/CRMScript.NetServer.md)
- [NSCustomerServiceAgent](/en/automation/crmscript/reference/CRMScript.NetServer.NSCustomerServiceAgent.md)
- [NSChatSessionEntity](/en/automation/crmscript/reference/CRMScript.NetServer.NSChatSessionEntity.md)
- [NSChatAgent](/en/automation/crmscript/reference/CRMScript.NetServer.NSChatAgent.md)
- [Chat sessions](/en/automation/chatbot/sessions.md)
- [Chat](/en/chat/learn/index.md)
