Show / Hide Table of Contents

Class ChatAgent

Proxy class for the Chat Agent Used when communicating remote using WebServices. Avoid using directly. Use the AgentFactory to create the proxy instead.

Inheritance
object
ChatAgent
Implements
IChatAgent
IAgent
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: SuperOffice.CRM.Services
Assembly: SuperOffice.Services.Implementation.dll
Syntax
public class ChatAgent : IChatAgent, IAgent

Constructors

ChatAgent(IChatPresenceImplementation, IChatSessionEntityImplementation, IChatTopicAgentImplementation, IChatTopicEntityImplementation, ISoRequestItemsAccessor)

Proxy class for the Chat Agent Used when communicating remote using WebServices. Avoid using directly. Use the AgentFactory to create the proxy instead.

Declaration
public ChatAgent(IChatPresenceImplementation chatPresenceImplementation, IChatSessionEntityImplementation chatSessionEntityImplementation, IChatTopicAgentImplementation chatTopicAgentImplementation, IChatTopicEntityImplementation chatTopicEntityImplementation, ISoRequestItemsAccessor accessor)
Parameters
Type Name Description
IChatPresenceImplementation chatPresenceImplementation
IChatSessionEntityImplementation chatSessionEntityImplementation
IChatTopicAgentImplementation chatTopicAgentImplementation
IChatTopicEntityImplementation chatTopicEntityImplementation
ISoRequestItemsAccessor accessor

ChatAgent(IChatPresenceImplementation, IChatSessionEntityImplementation, IChatTopicAgentImplementation, IChatTopicEntityImplementation, ISoRequestItemsAccessor, IDebugUser, IServiceCallsRepository)

Proxy class for the Chat Agent Used when communicating remote using WebServices. Avoid using directly. Use the AgentFactory to create the proxy instead.

Declaration
public ChatAgent(IChatPresenceImplementation chatPresenceImplementation, IChatSessionEntityImplementation chatSessionEntityImplementation, IChatTopicAgentImplementation chatTopicAgentImplementation, IChatTopicEntityImplementation chatTopicEntityImplementation, ISoRequestItemsAccessor accessor, IDebugUser debugUser, IServiceCallsRepository serviceCallsRepository)
Parameters
Type Name Description
IChatPresenceImplementation chatPresenceImplementation
IChatSessionEntityImplementation chatSessionEntityImplementation
IChatTopicAgentImplementation chatTopicAgentImplementation
IChatTopicEntityImplementation chatTopicEntityImplementation
ISoRequestItemsAccessor accessor
IDebugUser debugUser
IServiceCallsRepository serviceCallsRepository

Methods

AcceptChatSessionTransferAsync(int, CancellationToken)

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

Declaration
public Task<ChatSessionEntity> AcceptChatSessionTransferAsync(int chatSessionId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int chatSessionId

id of the chat session to send

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<ChatSessionEntity>

The updated chat session

AddChatMessageAsync(int, ChatMessage, CancellationToken)

Add a new message to a chat session

Declaration
public Task<ChatMessage> AddChatMessageAsync(int chatSessionId, ChatMessage message, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int chatSessionId

id of the chat session to add message to

ChatMessage message

Message to add

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<ChatMessage>

The chat message added to the session

AddChatTopicUserAgentAsync(int, ChatTopicAgent, CancellationToken)

Add a user to a chat topic

Declaration
public Task<ChatTopicAgent> AddChatTopicUserAgentAsync(int chatTopicId, ChatTopicAgent useragent, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int chatTopicId

Id of the chat topic

ChatTopicAgent useragent

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

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<ChatTopicAgent>

The user's role within the chat topic.

ChatSessionsForUserAsync(CancellationToken)

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

Declaration
public Task<ChatSessionEntity[]> ChatSessionsForUserAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<ChatSessionEntity[]>

Array of chat sessions the current user can access

ChatTopicsForUserAsync(CancellationToken)

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

Declaration
public Task<ChatTopicEntity[]> ChatTopicsForUserAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<ChatTopicEntity[]>

Array of chat topics the current user can access

CreateChatSessionForTopicAsync(int, CancellationToken)

Create a new session on a chat topic

Declaration
public Task<ChatSessionEntity> CreateChatSessionForTopicAsync(int chatTopicId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int chatTopicId

Id of the chat topic

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<ChatSessionEntity>

The new chat session.

CreateDefaultChatSessionEntityAsync(CancellationToken)

Loading default values into a new ChatSessionEntity. NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance

Declaration
public Task<ChatSessionEntity> CreateDefaultChatSessionEntityAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<ChatSessionEntity>

New ChatSessionEntity with default values

CreateDefaultChatTopicAgentAsync(CancellationToken)

Loading default values into a new ChatTopicAgent. NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance

Declaration
public Task<ChatTopicAgent> CreateDefaultChatTopicAgentAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<ChatTopicAgent>

New ChatTopicAgent with default values

CreateDefaultChatTopicEntityAsync(CancellationToken)

Loading default values into a new ChatTopicEntity. NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance

Declaration
public Task<ChatTopicEntity> CreateDefaultChatTopicEntityAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<ChatTopicEntity>

New ChatTopicEntity with default values

DeleteChatSessionEntityAsync(int, CancellationToken)

Deletes the ChatSessionEntity

Declaration
public Task DeleteChatSessionEntityAsync(int chatSessionEntityId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int chatSessionEntityId

The identity of the ChatSessionEntity

CancellationToken cancellationToken
Returns
Type Description
Task

DeleteChatTopicEntityAsync(int, CancellationToken)

Deletes the ChatTopicEntity

Declaration
public Task DeleteChatTopicEntityAsync(int chatTopicEntityId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int chatTopicEntityId

The identity of the ChatTopicEntity

CancellationToken cancellationToken
Returns
Type Description
Task

DeleteChatTopicUserAgentAsync(int, string, CancellationToken)

Remove a user from a topic

Declaration
public Task DeleteChatTopicUserAgentAsync(int chatTopicId, string username, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int chatTopicId

Id of the chat topic

string username

Associate username or associate id to delete.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

This method has no return value

GetChatMessagesAsync(int, int, CancellationToken)

Get all or some of the messages in a chat session

Declaration
public Task<ChatMessage[]> GetChatMessagesAsync(int chatSessionId, int after, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int chatSessionId

id of the chat session to reset

int after

Return messages after this message id

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<ChatMessage[]>

Array of chat messages in the session

GetChatPresenceAsync(CancellationToken)

Get the chat presence status for all chat users

Declaration
public Task<ChatPresence[]> GetChatPresenceAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<ChatPresence[]>

An array with ChatPresence objects for each user

GetChatSessionEntityAsync(int, CancellationToken)

Gets a ChatSessionEntity object.

Declaration
public Task<ChatSessionEntity> GetChatSessionEntityAsync(int chatSessionEntityId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int chatSessionEntityId

The identifier of the ChatSessionEntity object

CancellationToken cancellationToken
Returns
Type Description
Task<ChatSessionEntity>

ChatSessionEntity

GetChatTopicEntityAsync(int, CancellationToken)

Gets a ChatTopicEntity object.

Declaration
public Task<ChatTopicEntity> GetChatTopicEntityAsync(int chatTopicEntityId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int chatTopicEntityId

The identifier of the ChatTopicEntity object

CancellationToken cancellationToken
Returns
Type Description
Task<ChatTopicEntity>

ChatTopicEntity

GetChatTopicUserAgentAsync(int, string, CancellationToken)

Get a user assigned to a topic

Declaration
public Task<ChatTopicAgent> GetChatTopicUserAgentAsync(int chatTopicId, string username, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int chatTopicId

Id of the chat topic

string username

Associate username or associate id to get.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<ChatTopicAgent>

The user's role within the chat topic.

GetChatTopicUserAgentListAsync(int, CancellationToken)

Get list of users assigned to a chat topic

Declaration
public Task<ChatTopicAgent[]> GetChatTopicUserAgentListAsync(int chatTopicId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int chatTopicId

Id of the chat topic

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<ChatTopicAgent[]>

List of user agents assigned to chat topic.

GetChatTranscriptAsync(int, bool, CancellationToken)

Get the chat transcript, formatted as plain text or html

Declaration
public Task<string> GetChatTranscriptAsync(int chatSessionId, bool html, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int chatSessionId

id of the chat session to get the transcript for

bool html

Get transcript as HTML

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<string>

The transcript in text or HTML

GetUserAgentListAsync(bool, bool, CancellationToken)

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

Declaration
public Task<MDOListItem[]> GetUserAgentListAsync(bool flat, bool onlyPresent, CancellationToken cancellationToken = default)
Parameters
Type Name Description
bool flat

Return flat list instead of grouping by usergroup.

bool onlyPresent

Only show users who are present

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<MDOListItem[]>

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

IsWithinOpeningHoursAsync(int, CancellationToken)

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

Declaration
public Task<bool> IsWithinOpeningHoursAsync(int chatTopicId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int chatTopicId

The id of the topic to check

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<bool>

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

PickUpChatSessionAsync(int, CancellationToken)

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

Declaration
public Task<ChatSessionEntity> PickUpChatSessionAsync(int chatSessionId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int chatSessionId

id of the chat session to answer

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<ChatSessionEntity>

The chat session

PickUpFirstChatSessionAsync(CancellationToken)

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

Declaration
public Task<ChatSessionEntity> PickUpFirstChatSessionAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<ChatSessionEntity>

The picked-up chat session

RejectChatSessionTransferAsync(int, CancellationToken)

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

Declaration
public Task<ChatSessionEntity> RejectChatSessionTransferAsync(int chatSessionId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int chatSessionId

id of the chat session to send back

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<ChatSessionEntity>

The updated chat session

ResetChatSessionAsync(int, CancellationToken)

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

Declaration
public Task<ChatSessionEntity> ResetChatSessionAsync(int chatSessionId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int chatSessionId

id of the chat session to reset

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<ChatSessionEntity>

The updated chat session

SaveChatPresenceAsync(ChatPresence[], CancellationToken)

Save the chat presence for specified users

Declaration
public Task SaveChatPresenceAsync(ChatPresence[] chatPresence, CancellationToken cancellationToken = default)
Parameters
Type Name Description
ChatPresence[] chatPresence

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

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

void

SaveChatSessionEntityAsync(ChatSessionEntity, CancellationToken)

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

Declaration
public Task<ChatSessionEntity> SaveChatSessionEntityAsync(ChatSessionEntity chatSessionEntity, CancellationToken cancellationToken = default)
Parameters
Type Name Description
ChatSessionEntity chatSessionEntity

The ChatSessionEntity that is saved.

CancellationToken cancellationToken
Returns
Type Description
Task<ChatSessionEntity>

New or updated ChatSessionEntity

SaveChatTopicEntityAsync(ChatTopicEntity, CancellationToken)

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

Declaration
public Task<ChatTopicEntity> SaveChatTopicEntityAsync(ChatTopicEntity chatTopicEntity, CancellationToken cancellationToken = default)
Parameters
Type Name Description
ChatTopicEntity chatTopicEntity

The ChatTopicEntity that is saved.

CancellationToken cancellationToken
Returns
Type Description
Task<ChatTopicEntity>

New or updated ChatTopicEntity

TransferChatSessionAsync(int, string, CancellationToken)

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

Declaration
public Task<ChatSessionEntity> TransferChatSessionAsync(int chatSessionId, string toAssociate, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int chatSessionId

id of the chat session to send

string toAssociate

Associate username or associate id to send session to.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<ChatSessionEntity>

The updated chat session

UpdateChatTopicUserAgentAsync(int, string, ChatTopicAgent, CancellationToken)

Update a user's role in a chat topic

Declaration
public Task<ChatTopicAgent> UpdateChatTopicUserAgentAsync(int chatTopicId, string username, ChatTopicAgent useragent, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int chatTopicId

Id of the chat topic

string username

Associate username or associate id to get.

ChatTopicAgent useragent

User's updated role within the chat topic.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<ChatTopicAgent>

The user's role within the chat topic.

UpdateChatTopicUserAgentsAsync(int, ChatTopicAgent[], CancellationToken)

Update users roles in a chat topic

Declaration
public Task<ChatTopicAgent[]> UpdateChatTopicUserAgentsAsync(int chatTopicId, ChatTopicAgent[] useragents, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int chatTopicId

Id of the chat topic

ChatTopicAgent[] useragents

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

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<ChatTopicAgent[]>

The updated agents within the chat topic.

Implements

IChatAgent
IAgent
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top