> ## 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.

# NSChatMessage

> A message in a chat session. Carrier object for ChatMessage.

A message in a chat session. Carrier object for ChatMessage.

## Constructors

### NSChatMessage()

```crmscript theme={null}
NSChatMessage
```

Initializes a new instance of the NSChatMessage class.

## Methods

## GetAuthor()

```crmscript theme={null}
String GetAuthor()
```

**Returns:** [CRMScript.Global.String](CRMScript.Global.String) - The author of the message.

**Example:**

```crmscript theme={null}
NSChatMessage thing;
String author = thing.GetAuthor();
```

## GetChatMessageId()

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

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

**Example:**

```crmscript theme={null}
NSChatMessage thing;
Integer chatMessageId = thing.GetChatMessageId();
```

## GetChatSessionId()

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

**Returns:** [CRMScript.Global.Integer](CRMScript.Global.Integer) - The reference to the associated chat session.

**Example:**

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

## GetMessage()

```crmscript theme={null}
String GetMessage()
```

**Returns:** [CRMScript.Global.String](CRMScript.Global.String) - The message.

**Example:**

```crmscript theme={null}
NSChatMessage thing;
String message = thing.GetMessage();
```

## GetReadByCustomer()

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

**Returns:** [CRMScript.Global.Integer](CRMScript.Global.Integer) - Whether the message has been read by the customer or not.

**Example:**

```crmscript theme={null}
NSChatMessage thing;
Integer readByCustomer = thing.GetReadByCustomer();
```

## GetSpecialParam()

```crmscript theme={null}
String GetSpecialParam()
```

**Returns:** [CRMScript.Global.String](CRMScript.Global.String) - Special parameter for the special\_type.

**Example:**

```crmscript theme={null}
NSChatMessage thing;
String specialParam = thing.GetSpecialParam();
```

## GetSpecialType()

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

**Returns:** [CRMScript.Global.Integer](CRMScript.Global.Integer) - Indicates if it is a special message, such as a URL redirection. See \<xref href="CRMScript.NetServer.ChatMessageSpecialType" data-throw-if-not-resolved="false">\</xref>

**Example:**

```crmscript theme={null}
NSChatMessage thing;
Integer specialType = thing.GetSpecialType();
```

## GetType()

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

**Returns:** [CRMScript.Global.Integer](CRMScript.Global.Integer) - The type of the message. See \<xref href="CRMScript.NetServer.ChatMessageType" data-throw-if-not-resolved="false">\</xref>

**Example:**

```crmscript theme={null}
NSChatMessage thing;
Integer type = thing.GetType();
```

## GetWhenPosted()

```crmscript theme={null}
DateTime GetWhenPosted()
```

**Returns:** [CRMScript.Global.DateTime](CRMScript.Global.DateTime) - When the message was posted (UTC timestamp).

**Example:**

```crmscript theme={null}
NSChatMessage thing;
DateTime whenPosted = thing.GetWhenPosted();
```

## SetAuthor(String)

```crmscript theme={null}
Void SetAuthor(String author)
```

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

**Example:**

```crmscript theme={null}
NSChatMessage thing;
String author;
thing.SetAuthor(author);
```

## SetChatMessageId(Integer)

```crmscript theme={null}
Void SetChatMessageId(Integer chatMessageId)
```

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

**Example:**

```crmscript theme={null}
NSChatMessage thing;
Integer chatMessageId;
thing.SetChatMessageId(chatMessageId);
```

## SetChatSessionId(Integer)

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

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

**Example:**

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

## SetMessage(String)

```crmscript theme={null}
Void SetMessage(String message)
```

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

**Example:**

```crmscript theme={null}
NSChatMessage thing;
String message;
thing.SetMessage(message);
```

## SetReadByCustomer(Integer)

```crmscript theme={null}
Void SetReadByCustomer(Integer readByCustomer)
```

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

**Example:**

```crmscript theme={null}
NSChatMessage thing;
Integer readByCustomer;
thing.SetReadByCustomer(readByCustomer);
```

## SetSpecialParam(String)

```crmscript theme={null}
Void SetSpecialParam(String specialParam)
```

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

**Example:**

```crmscript theme={null}
NSChatMessage thing;
String specialParam;
thing.SetSpecialParam(specialParam);
```

## SetSpecialType(Integer)

```crmscript theme={null}
Void SetSpecialType(Integer specialType)
```

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

**Example:**

```crmscript theme={null}
NSChatMessage thing;
Integer specialType;
thing.SetSpecialType(specialType);
```

## SetType(Integer)

```crmscript theme={null}
Void SetType(Integer type)
```

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

**Example:**

```crmscript theme={null}
NSChatMessage thing;
Integer type;
thing.SetType(type);
```

## SetWhenPosted(DateTime)

```crmscript theme={null}
Void SetWhenPosted(DateTime whenPosted)
```

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

**Example:**

```crmscript theme={null}
NSChatMessage thing;
DateTime whenPosted;
thing.SetWhenPosted(whenPosted);
```


## Related topics

- [NSChatAgent](/en/automation/crmscript/reference/CRMScript.NetServer.NSChatAgent.md)
- [Namespace CRMScript.NetServer](/en/automation/crmscript/reference/CRMScript.NetServer.md)
- [Add Chat Message](/en/api/reference/restful/agent/chat_agent/add-chat-message.md)
- [Get Chat Messages](/en/api/reference/restful/rest/chatsession/get-chat-messages.md)
- [chat_message table](/en/database/tables/chat-message.md)
