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

# SuperOffice.WebApi.Agents.ChatAgent

# \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent">\</a> Class ChatAgent

Namespace: [SuperOffice.WebApi.Agents](SuperOffice.WebApi.Agents.md)\
Assembly: SuperOffice.WebApi.dll

Chat functions. Manage chat channels, sessions and messages.

```csharp theme={null}
public class ChatAgent : AgentBase, IChatAgent, IAgentBase, IDisposable
```

#### Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) ←
[AgentBase](SuperOffice.WebApi.Agents.AgentBase.md) ←
[ChatAgent](SuperOffice.WebApi.Agents.ChatAgent.md)

#### Implements

[IChatAgent](SuperOffice.WebApi.Agents.IChatAgent.md),
[IAgentBase](SuperOffice.WebApi.Agents.IAgentBase.md),
[IDisposable](https://learn.microsoft.com/dotnet/api/system.idisposable)

#### Inherited Members

[AgentBase.\_json](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__json),
[AgentBase.\_binary](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__binary),
[AgentBase.\_config](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__config),
[AgentBase.\_client](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__client),
[AgentBase.\_disposeClient](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__disposeClient),
[AgentBase.Merge(RequestOptions)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Merge_SuperOffice_WebApi_RequestOptions_),
[AgentBase.BuildRequestFromObject(HttpMethod, string, object, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_BuildRequestFromObject_System_Net_Http_HttpMethod_System_String_System_Object_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.BuildRequestFromStream(HttpMethod, string, Stream, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_BuildRequestFromStream_System_Net_Http_HttpMethod_System_String_System_IO_Stream_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.BuildRequestFromObjectWithStream(HttpMethod, string, object, Stream, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_BuildRequestFromObjectWithStream_System_Net_Http_HttpMethod_System_String_System_Object_System_IO_Stream_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.ParseAuthorization(IAuthorization)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ParseAuthorization_SuperOffice_WebApi_Authorization_IAuthorization_),
[AgentBase.CancelRequest()](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_CancelRequest),
[AgentBase.SendRequestObject(HttpMethod, string, object, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_SendRequestObject_System_Net_Http_HttpMethod_System_String_System_Object_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.SendRequestObjectWithStream(HttpMethod, string, object, Stream, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_SendRequestObjectWithStream_System_Net_Http_HttpMethod_System_String_System_Object_System_IO_Stream_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.SendRequest(HttpRequestMessage, RequestOptions)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_SendRequest_System_Net_Http_HttpRequestMessage_SuperOffice_WebApi_RequestOptions_),
[AgentBase.ThrowOnResponseErrorAsync(HttpRequestMessage, HttpResponseMessage)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ThrowOnResponseErrorAsync_System_Net_Http_HttpRequestMessage_System_Net_Http_HttpResponseMessage_),
[AgentBase.ParseResponse\<T\&gt;(HttpResponseMessage)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ParseResponse__1_System_Net_Http_HttpResponseMessage_),
[AgentBase.Finally(RequestOptions)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Finally_SuperOffice_WebApi_RequestOptions_),
[AgentBase.Dispose()](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Dispose),
[AgentBase.Configuration](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Configuration),
[AgentBase.Client](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Client),
[AgentBase.HasRunningRequest](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_HasRunningRequest),
[AgentBase.ClientCancellationTokenSource](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ClientCancellationTokenSource),
[AgentBase.ProgressListener](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ProgressListener),
[AgentBase.UploadProgressListener](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_UploadProgressListener),
[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring),
[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object\)),
[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object-system-object\)),
[object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals),
[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode),
[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype),
[object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone)

## Examples

\<pre>\<code class="lang-csharp">using SuperOffice.WebApi;
using SuperOffice.WebApi.Agents;

var mySession = new WebApiOptions("[http://example.com/super/api](http://example.com/super/api)");
mySession.Authorization = new AuthorizationUsernamePassword("user", "pass");
using (ChatAgent agent = new ChatAgent(mySession))
\{
// call methods on agent here...
}\</code>\</pre>

## Constructors

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_\_ctor\_System\_Net\_Http\_HttpClient\_">\</a> ChatAgent(HttpClient)

Constructor: Chat functions. Manage chat channels, sessions and messages.

```csharp theme={null}
public ChatAgent(HttpClient httpClient)
```

#### Parameters

`httpClient` [HttpClient](https://learn.microsoft.com/dotnet/api/system.net.http.httpclient)

Use this HTTP client instead of making own HttpClient instance.

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_\_ctor\_SuperOffice\_WebApi\_WebApiOptions\_System\_Net\_Http\_HttpClient\_">\</a> ChatAgent(WebApiOptions, HttpClient)

Constructor: Chat functions. Manage chat channels, sessions and messages.

```csharp theme={null}
public ChatAgent(WebApiOptions options, HttpClient httpClient = null)
```

#### Parameters

`options` [WebApiOptions](SuperOffice.WebApi.WebApiOptions.md)

Base URL and authentication values.

`httpClient` [HttpClient](https://learn.microsoft.com/dotnet/api/system.net.http.httpclient)

Optional: Use this HTTP client instead of making a new one.

## Methods

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_AcceptChatSessionTransferAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> AcceptChatSessionTransferAsync(int, RequestOptions)

Accept the transfer: assign the session to the user. If the session is not being transferred, nothing happens.

```csharp theme={null}
public Task<ChatSessionEntity> AcceptChatSessionTransferAsync(int chatSessionId, RequestOptions requestOptions = null)
```

#### Parameters

`chatSessionId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

id of the chat session to send

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatSessionEntity](SuperOffice.WebApi.Data.ChatSessionEntity.md)\&gt;

The updated chat session

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_AddChatMessageAsync\_System\_Int32\_SuperOffice\_WebApi\_Data\_ChatMessage\_SuperOffice\_WebApi\_RequestOptions\_">\</a> AddChatMessageAsync(int, ChatMessage, RequestOptions)

Add a new message to a chat session

```csharp theme={null}
public Task<ChatMessage> AddChatMessageAsync(int chatSessionId, ChatMessage message, RequestOptions requestOptions = null)
```

#### Parameters

`chatSessionId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

id of the chat session to add message to

`message` [ChatMessage](SuperOffice.WebApi.Data.ChatMessage.md)

Message to add

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatMessage](SuperOffice.WebApi.Data.ChatMessage.md)\&gt;

The chat message added to the session

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_AddChatTopicUserAgentAsync\_System\_Int32\_SuperOffice\_WebApi\_Data\_ChatTopicAgent\_SuperOffice\_WebApi\_RequestOptions\_">\</a> AddChatTopicUserAgentAsync(int, ChatTopicAgent, RequestOptions)

Add a user to a chat topic

```csharp theme={null}
public Task<ChatTopicAgent> AddChatTopicUserAgentAsync(int chatTopicId, ChatTopicAgent useragent, RequestOptions requestOptions = null)
```

#### Parameters

`chatTopicId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of the chat topic

`useragent` [ChatTopicAgent](SuperOffice.WebApi.Data.ChatTopicAgent.md)

User's role within the chat topic to add to topic.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatTopicAgent](SuperOffice.WebApi.Data.ChatTopicAgent.md)\&gt;

The user's role within the chat topic.

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_ChatSessionsForUserAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> ChatSessionsForUserAsync(RequestOptions)

Get all chat sessions which this user is a member of. Members means that you have at least one of: Can Respond, Notifications, Listen or Manager

```csharp theme={null}
public Task<ChatSessionEntity[]> ChatSessionsForUserAsync(RequestOptions requestOptions = null)
```

#### Parameters

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatSessionEntity](SuperOffice.WebApi.Data.ChatSessionEntity.md)\[]\&gt;

Array of chat sessions the current user can access

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_ChatTopicsForUserAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> ChatTopicsForUserAsync(RequestOptions)

Get all chat topics which this user is a member of. Members means that you have at least one of: Can Respond, Notifications, Listen or Manager

```csharp theme={null}
public Task<ChatTopicEntity[]> ChatTopicsForUserAsync(RequestOptions requestOptions = null)
```

#### Parameters

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatTopicEntity](SuperOffice.WebApi.Data.ChatTopicEntity.md)\[]\&gt;

Array of chat topics the current user can access

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_CreateChatSessionForTopicAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateChatSessionForTopicAsync(int, RequestOptions)

Create a new session on a chat topic

```csharp theme={null}
public Task<ChatSessionEntity> CreateChatSessionForTopicAsync(int chatTopicId, RequestOptions requestOptions = null)
```

#### Parameters

`chatTopicId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of the chat topic

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatSessionEntity](SuperOffice.WebApi.Data.ChatSessionEntity.md)\&gt;

The new chat session.

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_CreateDefaultChatSessionEntityAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateDefaultChatSessionEntityAsync(RequestOptions)

Set default values into a new ChatSessionEntity.
NetServer calculates default values on the entity, which is required when creating/storing a new instance

```csharp theme={null}
public Task<ChatSessionEntity> CreateDefaultChatSessionEntityAsync(RequestOptions requestOptions = null)
```

#### Parameters

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatSessionEntity](SuperOffice.WebApi.Data.ChatSessionEntity.md)\&gt;

A blank ChatSessionEntity

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_CreateDefaultChatTopicAgentAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateDefaultChatTopicAgentAsync(RequestOptions)

Set default values into a new ChatTopicAgent.
NetServer calculates default values on the entity, which is required when creating/storing a new instance

```csharp theme={null}
public Task<ChatTopicAgent> CreateDefaultChatTopicAgentAsync(RequestOptions requestOptions = null)
```

#### Parameters

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatTopicAgent](SuperOffice.WebApi.Data.ChatTopicAgent.md)\&gt;

A blank ChatTopicAgent

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_CreateDefaultChatTopicEntityAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateDefaultChatTopicEntityAsync(RequestOptions)

Set default values into a new ChatTopicEntity.
NetServer calculates default values on the entity, which is required when creating/storing a new instance

```csharp theme={null}
public Task<ChatTopicEntity> CreateDefaultChatTopicEntityAsync(RequestOptions requestOptions = null)
```

#### Parameters

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatTopicEntity](SuperOffice.WebApi.Data.ChatTopicEntity.md)\&gt;

A blank ChatTopicEntity

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_DeleteChatSessionEntityAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> DeleteChatSessionEntityAsync(int, RequestOptions)

Deletes the ChatSessionEntity

```csharp theme={null}
public Task DeleteChatSessionEntityAsync(int chatSessionEntityId, RequestOptions requestOptions = null)
```

#### Parameters

`chatSessionEntityId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The identity of the ChatSessionEntity

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_DeleteChatTopicEntityAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> DeleteChatTopicEntityAsync(int, RequestOptions)

Deletes the ChatTopicEntity

```csharp theme={null}
public Task DeleteChatTopicEntityAsync(int chatTopicEntityId, RequestOptions requestOptions = null)
```

#### Parameters

`chatTopicEntityId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The identity of the ChatTopicEntity

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_DeleteChatTopicUserAgentAsync\_System\_Int32\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> DeleteChatTopicUserAgentAsync(int, string, RequestOptions)

Remove a user from a topic

```csharp theme={null}
public Task DeleteChatTopicUserAgentAsync(int chatTopicId, string username, RequestOptions requestOptions = null)
```

#### Parameters

`chatTopicId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of the chat topic

`username` [string](https://learn.microsoft.com/dotnet/api/system.string)

Associate username or associate id to delete.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

This method has no return value

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_GetChatMessagesAsync\_System\_Int32\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetChatMessagesAsync(int, int, RequestOptions)

Get all or some of the messages in a chat session

```csharp theme={null}
public Task<ChatMessage[]> GetChatMessagesAsync(int chatSessionId, int after, RequestOptions requestOptions = null)
```

#### Parameters

`chatSessionId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

id of the chat session to reset

`after` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Return messages after this message id

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatMessage](SuperOffice.WebApi.Data.ChatMessage.md)\[]\&gt;

Array of chat messages in the session

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_GetChatPresenceAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetChatPresenceAsync(RequestOptions)

Get the chat presence status for all chat users

```csharp theme={null}
public Task<ChatPresence[]> GetChatPresenceAsync(RequestOptions requestOptions = null)
```

#### Parameters

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatPresence](SuperOffice.WebApi.Data.ChatPresence.md)\[]\&gt;

An array with ChatPresence objects for each user

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_GetChatSessionEntityAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetChatSessionEntityAsync(int, RequestOptions)

Gets a specific ChatSessionEntity object.

```csharp theme={null}
public Task<ChatSessionEntity> GetChatSessionEntityAsync(int chatSessionEntityId, RequestOptions requestOptions = null)
```

#### Parameters

`chatSessionEntityId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The identifier of the ChatSessionEntity object

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatSessionEntity](SuperOffice.WebApi.Data.ChatSessionEntity.md)\&gt;

ChatSessionEntity

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_GetChatTopicEntityAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetChatTopicEntityAsync(int, RequestOptions)

Gets a specific ChatTopicEntity object.

```csharp theme={null}
public Task<ChatTopicEntity> GetChatTopicEntityAsync(int chatTopicEntityId, RequestOptions requestOptions = null)
```

#### Parameters

`chatTopicEntityId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The identifier of the ChatTopicEntity object

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatTopicEntity](SuperOffice.WebApi.Data.ChatTopicEntity.md)\&gt;

ChatTopicEntity

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_GetChatTopicUserAgentAsync\_System\_Int32\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetChatTopicUserAgentAsync(int, string, RequestOptions)

Get a user assigned to a topic

```csharp theme={null}
public Task<ChatTopicAgent> GetChatTopicUserAgentAsync(int chatTopicId, string username, RequestOptions requestOptions = null)
```

#### Parameters

`chatTopicId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of the chat topic

`username` [string](https://learn.microsoft.com/dotnet/api/system.string)

Associate username or associate id to get.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatTopicAgent](SuperOffice.WebApi.Data.ChatTopicAgent.md)\&gt;

The user's role within the chat topic.

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_GetChatTopicUserAgentListAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetChatTopicUserAgentListAsync(int, RequestOptions)

Get list of users assigned to a chat topic

```csharp theme={null}
public Task<ChatTopicAgent[]> GetChatTopicUserAgentListAsync(int chatTopicId, RequestOptions requestOptions = null)
```

#### Parameters

`chatTopicId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of the chat topic

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatTopicAgent](SuperOffice.WebApi.Data.ChatTopicAgent.md)\[]\&gt;

List of user agents assigned to chat topic.

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_GetChatTranscriptAsync\_System\_Int32\_System\_Boolean\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetChatTranscriptAsync(int, bool, RequestOptions)

Get the chat transcript, formatted as plain text or html

```csharp theme={null}
public Task<string> GetChatTranscriptAsync(int chatSessionId, bool html, RequestOptions requestOptions = null)
```

#### Parameters

`chatSessionId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

id of the chat session to get the transcript for

`html` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

Get transcript as HTML

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[string](https://learn.microsoft.com/dotnet/api/system.string)\&gt;

The transcript in text or HTML

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_GetUserAgentListAsync\_System\_Boolean\_System\_Boolean\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetUserAgentListAsync(bool, bool, RequestOptions)

Get list of users that can be assigned to chat topics. Users with Chat-CALs from the MDO list 'chatuser'

```csharp theme={null}
public Task<MDOListItem[]> GetUserAgentListAsync(bool flat, bool onlyPresent, RequestOptions requestOptions = null)
```

#### Parameters

`flat` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

Return flat list instead of grouping by usergroup.

`onlyPresent` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

Only show users who are present

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[MDOListItem](SuperOffice.WebApi.Data.MDOListItem.md)\[]\&gt;

List of user agents that can be assigned to chat topics, possibly grouped by usergroup.

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_IsWithinOpeningHoursAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> IsWithinOpeningHoursAsync(int, RequestOptions)

Check if we are right now within the opening hours of the given topic. Will use timezones to calculate if configured.

```csharp theme={null}
public Task<bool> IsWithinOpeningHoursAsync(int chatTopicId, RequestOptions requestOptions = null)
```

#### Parameters

`chatTopicId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The id of the topic to check

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[bool](https://learn.microsoft.com/dotnet/api/system.boolean)\&gt;

True if we are within opening hours, or if the topic does not use opening hours

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_PickUpChatSessionAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> PickUpChatSessionAsync(int, RequestOptions)

'answer' the session: assign the session to the user. The welcome message is sent to the customer. Returns NULL if session was not in queue.

```csharp theme={null}
public Task<ChatSessionEntity> PickUpChatSessionAsync(int chatSessionId, RequestOptions requestOptions = null)
```

#### Parameters

`chatSessionId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

id of the chat session to answer

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatSessionEntity](SuperOffice.WebApi.Data.ChatSessionEntity.md)\&gt;

The chat session

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_PickUpFirstChatSessionAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> PickUpFirstChatSessionAsync(RequestOptions)

'answer' the first available session from the queue: assign the session to the user. The welcome message is sent to the customer.

```csharp theme={null}
public Task<ChatSessionEntity> PickUpFirstChatSessionAsync(RequestOptions requestOptions = null)
```

#### Parameters

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatSessionEntity](SuperOffice.WebApi.Data.ChatSessionEntity.md)\&gt;

The picked-up chat session

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_RejectChatSessionTransferAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> RejectChatSessionTransferAsync(int, RequestOptions)

Do not want. Deny the transfer to the user. If the session is not being transferred, nothing happens.

```csharp theme={null}
public Task<ChatSessionEntity> RejectChatSessionTransferAsync(int chatSessionId, RequestOptions requestOptions = null)
```

#### Parameters

`chatSessionId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

id of the chat session to send back

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatSessionEntity](SuperOffice.WebApi.Data.ChatSessionEntity.md)\&gt;

The updated chat session

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_ResetChatSessionAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> ResetChatSessionAsync(int, RequestOptions)

Reset chat session, put it back on the queue for pickup. Used by bots to hand off a session to human

```csharp theme={null}
public Task<ChatSessionEntity> ResetChatSessionAsync(int chatSessionId, RequestOptions requestOptions = null)
```

#### Parameters

`chatSessionId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

id of the chat session to reset

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatSessionEntity](SuperOffice.WebApi.Data.ChatSessionEntity.md)\&gt;

The updated chat session

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_SaveChatPresenceAsync\_SuperOffice\_WebApi\_Data\_ChatPresence\_\_\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SaveChatPresenceAsync(ChatPresence\[], RequestOptions)

Save the chat presence for specified users

```csharp theme={null}
public Task SaveChatPresenceAsync(ChatPresence[] chatPresence, RequestOptions requestOptions = null)
```

#### Parameters

`chatPresence` [ChatPresence](SuperOffice.WebApi.Data.ChatPresence.md)\[]

An array with ChatPresence objects. Only the UserId and Present information is used while saving

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

void

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_SaveChatSessionEntityAsync\_SuperOffice\_WebApi\_Data\_ChatSessionEntity\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SaveChatSessionEntityAsync(ChatSessionEntity, RequestOptions)

Updates the existing ChatSessionEntity or creates a new ChatSessionEntity if the id parameter is 0.

```csharp theme={null}
public Task<ChatSessionEntity> SaveChatSessionEntityAsync(ChatSessionEntity chatSessionEntity, RequestOptions requestOptions = null)
```

#### Parameters

`chatSessionEntity` [ChatSessionEntity](SuperOffice.WebApi.Data.ChatSessionEntity.md)

The ChatSessionEntity that is saved.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatSessionEntity](SuperOffice.WebApi.Data.ChatSessionEntity.md)\&gt;

New or updated ChatSessionEntity

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_SaveChatTopicEntityAsync\_SuperOffice\_WebApi\_Data\_ChatTopicEntity\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SaveChatTopicEntityAsync(ChatTopicEntity, RequestOptions)

Updates the existing ChatTopicEntity or creates a new ChatTopicEntity if the id parameter is 0.

```csharp theme={null}
public Task<ChatTopicEntity> SaveChatTopicEntityAsync(ChatTopicEntity chatTopicEntity, RequestOptions requestOptions = null)
```

#### Parameters

`chatTopicEntity` [ChatTopicEntity](SuperOffice.WebApi.Data.ChatTopicEntity.md)

The ChatTopicEntity that is saved.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatTopicEntity](SuperOffice.WebApi.Data.ChatTopicEntity.md)\&gt;

New or updated ChatTopicEntity

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_TransferChatSessionAsync\_System\_Int32\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> TransferChatSessionAsync(int, string, RequestOptions)

Request to send the session to another user. If the session does not belong to the user, nothing happens.

```csharp theme={null}
public Task<ChatSessionEntity> TransferChatSessionAsync(int chatSessionId, string toAssociate, RequestOptions requestOptions = null)
```

#### Parameters

`chatSessionId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

id of the chat session to send

`toAssociate` [string](https://learn.microsoft.com/dotnet/api/system.string)

Associate username or associate id to send session to.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatSessionEntity](SuperOffice.WebApi.Data.ChatSessionEntity.md)\&gt;

The updated chat session

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_UpdateChatTopicUserAgentAsync\_System\_Int32\_System\_String\_SuperOffice\_WebApi\_Data\_ChatTopicAgent\_SuperOffice\_WebApi\_RequestOptions\_">\</a> UpdateChatTopicUserAgentAsync(int, string, ChatTopicAgent, RequestOptions)

Update a user's role in a chat topic

```csharp theme={null}
public Task<ChatTopicAgent> UpdateChatTopicUserAgentAsync(int chatTopicId, string username, ChatTopicAgent useragent, RequestOptions requestOptions = null)
```

#### Parameters

`chatTopicId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of the chat topic

`username` [string](https://learn.microsoft.com/dotnet/api/system.string)

Associate username or associate id to get.

`useragent` [ChatTopicAgent](SuperOffice.WebApi.Data.ChatTopicAgent.md)

User's updated role within the chat topic.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatTopicAgent](SuperOffice.WebApi.Data.ChatTopicAgent.md)\&gt;

The user's role within the chat topic.

### \<a id="SuperOffice\_WebApi\_Agents\_ChatAgent\_UpdateChatTopicUserAgentsAsync\_System\_Int32\_SuperOffice\_WebApi\_Data\_ChatTopicAgent\_\_\_SuperOffice\_WebApi\_RequestOptions\_">\</a> UpdateChatTopicUserAgentsAsync(int, ChatTopicAgent\[], RequestOptions)

Update users roles in a chat topic

```csharp theme={null}
public Task<ChatTopicAgent[]> UpdateChatTopicUserAgentsAsync(int chatTopicId, ChatTopicAgent[] useragents, RequestOptions requestOptions = null)
```

#### Parameters

`chatTopicId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of the chat topic

`useragents` [ChatTopicAgent](SuperOffice.WebApi.Data.ChatTopicAgent.md)\[]

Users new/updated roles within the chat topic. Replaces existing roles

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatTopicAgent](SuperOffice.WebApi.Data.ChatTopicAgent.md)\[]\&gt;

The updated agents within the chat topic.


## Related topics

- [SuperOffice.WebApi.Data.ChatTopicAgent](/en/api/reference/webapi/SuperOffice.WebApi.Data.ChatTopicAgent.md)
- [SuperOffice.WebApi.Data.ChatSessionEntity](/en/api/reference/webapi/SuperOffice.WebApi.Data.ChatSessionEntity.md)
- [SuperOffice.WebApi.Data.ChatTopicEntity](/en/api/reference/webapi/SuperOffice.WebApi.Data.ChatTopicEntity.md)
- [SuperOffice.WebApi.Data.ChatMessage](/en/api/reference/webapi/SuperOffice.WebApi.Data.ChatMessage.md)
- [SuperOffice.WebApi.Data.ChatPresence](/en/api/reference/webapi/SuperOffice.WebApi.Data.ChatPresence.md)
- [SuperOffice.WebApi.Data.ChatSummaryItem](/en/api/reference/webapi/SuperOffice.WebApi.Data.ChatSummaryItem.md)
