Class NSChatAgent
Chat functions. Manage chat channels, sessions, and messages.
Syntax
Examples
NSChatAgent agent;
agent.callMethod(arg1, arg2);
Constructors
NSChatAgent()
Chat functions. Manage chat channels, sessions, and messages.
Declaration
Examples
NSChatAgent agent;
agent.callMethod(arg1, arg2);
Methods
AcceptChatSessionTransfer(Integer)
Accept the transfer: assign the session to the user. If the session is not being transferred, nothing happens.
Declaration
NSChatSessionEntity AcceptChatSessionTransfer(Integer chatSessionId)
Parameters
Type |
Name |
Description |
Integer |
chatSessionId |
|
Returns
Examples
NSChatAgent agent;
Integer chatSessionId;
NSChatSessionEntity res = agent.AcceptChatSessionTransfer(chatSessionId);
AddChatMessage(Integer,NSChatMessage)
Adds a new message to a chat session
Declaration
NSChatMessage AddChatMessage(Integer chatSessionId, NSChatMessage message)
Parameters
Returns
Examples
NSChatAgent agent;
Integer chatSessionId;
NSChatMessage message;
NSChatMessage res = agent.AddChatMessage(chatSessionId, message);
AddChatTopicUserAgent(Integer,NSChatTopicAgent)
Adds a user to a chat topic
Declaration
NSChatTopicAgent AddChatTopicUserAgent(Integer chatTopicId, NSChatTopicAgent useragent)
Parameters
Returns
Examples
NSChatAgent agent;
Integer chatTopicId;
NSChatTopicAgent useragent;
NSChatTopicAgent res = agent.AddChatTopicUserAgent(chatTopicId, useragent);
ChatSessionsForUser()
Gets all chat sessions which this user is a member of.
Declaration
NSChatSessionEntity[] ChatSessionsForUser()
Returns
Examples
NSChatAgent agent;
NSChatSessionEntity[] res = agent.ChatSessionsForUser();
ChatTopicsForUser()
Gets all chat topics which this user is a member of.nd, Notifications, Listen or Manager.
Declaration
NSChatTopicEntity[] ChatTopicsForUser()
Returns
Examples
NSChatAgent agent;
NSChatTopicEntity[] res = agent.ChatTopicsForUser();
CreateChatSessionForTopic(Integer)
Creates a new session on a chat topic
Declaration
NSChatSessionEntity CreateChatSessionForTopic(Integer chatTopicId)
Parameters
Type |
Name |
Description |
Integer |
chatTopicId |
|
Returns
Examples
NSChatAgent agent;
Integer chatTopicId;
NSChatSessionEntity res = agent.CreateChatSessionForTopic(chatTopicId);
CreateDefaultChatSessionEntity()
Sets default values into a new NSChatSessionEntity.
Declaration
NSChatSessionEntity CreateDefaultChatSessionEntity()
Returns
Examples
NSChatAgent agent;
NSChatSessionEntity thing = agent.CreateDefaultChatSessionEntity();
thing = agent.SaveChatSessionEntity(thing);
CreateDefaultChatTopicAgent()
Sets default values into a new NSChatTopicAgent.
Declaration
NSChatTopicAgent CreateDefaultChatTopicAgent()
Returns
Examples
NSChatAgent agent;
NSChatTopicAgent thing = agent.CreateDefaultChatTopicAgent();
thing = agent.SaveChatTopicAgent(thing);
CreateDefaultChatTopicEntity()
Sets default values into a new NSChatTopicEntity.
Declaration
NSChatTopicEntity CreateDefaultChatTopicEntity()
Returns
Examples
NSChatAgent agent;
NSChatTopicEntity thing = agent.CreateDefaultChatTopicEntity();
thing = agent.SaveChatTopicEntity(thing);
DeleteChatSessionEntity(Integer)
Deletes the NSChatSessionEntity
Declaration
Void DeleteChatSessionEntity(Integer chatSessionEntity)
Parameters
Type |
Name |
Description |
Integer |
chatSessionEntity |
|
Returns
Examples
NSChatAgent agent;
agent.DeleteChatSessionEntity(123);
DeleteChatTopicEntity(Integer)
Deletes the NSChatTopicEntity
Declaration
Void DeleteChatTopicEntity(Integer chatTopicEntity)
Parameters
Type |
Name |
Description |
Integer |
chatTopicEntity |
|
Returns
Examples
NSChatAgent agent;
agent.DeleteChatTopicEntity(123);
DeleteChatTopicUserAgent(Integer,String)
Removes a user from a topic
Declaration
Void DeleteChatTopicUserAgent(Integer chatTopicId, String username)
Parameters
Returns
Examples
NSChatAgent agent;
Integer chatTopicId;
String username;
agent.DeleteChatTopicUserAgent(chatTopicId, username);
GetChatMessages(Integer,Integer)
Gets all or some of the messages in a chat session
Declaration
NSChatMessage[] GetChatMessages(Integer chatSessionId, Integer after)
Parameters
Returns
Examples
NSChatAgent agent;
Integer chatSessionId;
Integer after;
NSChatMessage[] res = agent.GetChatMessages(chatSessionId, after);
GetChatPresence()
Gets the chat presence status for all chat users.
Declaration
NSChatPresence[] GetChatPresence()
Returns
Examples
NSChatAgent agent;
NSChatPresence[] res = agent.GetChatPresence();
GetChatSessionEntity(Integer)
Gets an NSChatSessionEntity object.
Declaration
NSChatSessionEntity GetChatSessionEntity(Integer chatSessionEntityId)
Parameters
Type |
Name |
Description |
Integer |
chatSessionEntityId |
|
Returns
Examples
NSChatAgent agent;
NSChatSessionEntity thing = agent.GetChatSessionEntity(123);
GetChatTopicEntity(Integer)
Gets an NSChatTopicEntity object.
Declaration
NSChatTopicEntity GetChatTopicEntity(Integer chatTopicEntityId)
Parameters
Type |
Name |
Description |
Integer |
chatTopicEntityId |
|
Returns
Examples
NSChatAgent agent;
NSChatTopicEntity thing = agent.GetChatTopicEntity(123);
GetChatTopicUserAgent(Integer,String)
Gets a user assigned to a topic
Declaration
NSChatTopicAgent GetChatTopicUserAgent(Integer chatTopicId, String username)
Parameters
Returns
Examples
NSChatAgent agent;
Integer chatTopicId;
String username;
NSChatTopicAgent res = agent.GetChatTopicUserAgent(chatTopicId, username);
GetChatTopicUserAgentList(Integer)
Gets a list of users assigned to a chat topic.
Declaration
NSChatTopicAgent[] GetChatTopicUserAgentList(Integer chatTopicId)
Parameters
Type |
Name |
Description |
Integer |
chatTopicId |
|
Returns
Examples
NSChatAgent agent;
Integer chatTopicId;
NSChatTopicAgent[] res = agent.GetChatTopicUserAgentList(chatTopicId);
GetChatTranscript(Integer,Bool)
Gets the chat transcript, formatted as plain text or HTML.
Declaration
String GetChatTranscript(Integer chatSessionId, Bool html)
Parameters
Returns
Type |
Description |
String |
chat transcript, formatted as plain text or HTMl.
|
Examples
NSChatAgent agent;
Integer chatSessionId;
Bool html;
String res = agent.GetChatTranscript(chatSessionId, html);
GetUserAgentList(Bool,Bool)
Gets list of users that can be assigned to chat topics.
Declaration
NSMDOListItem[] GetUserAgentList(Bool flat, Bool onlyPresent)
Parameters
Type |
Name |
Description |
Bool |
flat |
|
Bool |
onlyPresent |
|
Returns
Examples
NSChatAgent agent;
Bool flat;
Bool onlyPresent;
NSMDOListItem[] res = agent.GetUserAgentList(flat, onlyPresent);
IsWithinOpeningHours(Integer)
Checks if we are right now within the opening hours of the given topic. Will use timezones to calculate if configured.
Declaration
Bool IsWithinOpeningHours(Integer chatTopicId)
Parameters
Type |
Name |
Description |
Integer |
chatTopicId |
|
Returns
Examples
NSChatAgent agent;
Integer chatTopicId;
Bool res = agent.IsWithinOpeningHours(chatTopicId);
PickUpChatSession(Integer)
Answer the session: assign the session to the user. The welcome message is sent to the customer.
Declaration
NSChatSessionEntity PickUpChatSession(Integer chatSessionId)
Parameters
Type |
Name |
Description |
Integer |
chatSessionId |
|
Returns
Examples
NSChatAgent agent;
Integer chatSessionId;
NSChatSessionEntity res = agent.PickUpChatSession(chatSessionId);
PickUpFirstChatSession()
Answer the first available session from the queue: assign the session to the user. The welcome message is sent to the customer.
Declaration
NSChatSessionEntity PickUpFirstChatSession()
Returns
Examples
NSChatAgent agent;
NSChatSessionEntity res = agent.PickUpFirstChatSession();
RejectChatSessionTransfer(Integer)
Do not want. Deny the transfer to the user. If the session is not being transferred, nothing happens.
Declaration
NSChatSessionEntity RejectChatSessionTransfer(Integer chatSessionId)
Parameters
Type |
Name |
Description |
Integer |
chatSessionId |
|
Returns
Examples
NSChatAgent agent;
Integer chatSessionId;
NSChatSessionEntity res = agent.RejectChatSessionTransfer(chatSessionId);
ResetChatSession(Integer)
Resets chat session, puts it back on the queue for pickup.
Declaration
NSChatSessionEntity ResetChatSession(Integer chatSessionId)
Parameters
Type |
Name |
Description |
Integer |
chatSessionId |
|
Returns
Examples
NSChatAgent agent;
Integer chatSessionId;
NSChatSessionEntity res = agent.ResetChatSession(chatSessionId);
SaveChatPresence(NSChatPresence[])
Saves the chat presence for specified users
Declaration
Void SaveChatPresence(NSChatPresence[] chatPresence)
Parameters
Returns
Examples
NSChatAgent agent;
NSChatPresence[] chatPresence;
agent.SaveChatPresence(chatPresence);
SaveChatSessionEntity(NSChatSessionEntity)
Updates the existing NSChatSessionEntity or creates a new NSChatSessionEntity if the id parameter is 0
Declaration
NSChatSessionEntity SaveChatSessionEntity(NSChatSessionEntity chatSessionEntity)
Parameters
Returns
Examples
NSChat agent;
NSChatSessionEntity thing = agent.CreateDefaultChatSessionEntity();
thing = agent.SaveChatSessionEntity(thing);
SaveChatTopicEntity(NSChatTopicEntity)
Updates the existing NSChatTopicEntity or creates a new NSChatTopicEntity if the id parameter is 0
Declaration
NSChatTopicEntity SaveChatTopicEntity(NSChatTopicEntity chatTopicEntity)
Parameters
Returns
Examples
NSChat agent;
NSChatTopicEntity thing = agent.CreateDefaultChatTopicEntity();
thing = agent.SaveChatTopicEntity(thing);
TransferChatSession(Integer,String)
Requests to send the session to another user. If the session does not belong to the user, nothing happens.
Declaration
NSChatSessionEntity TransferChatSession(Integer chatSessionId, String toAssociate)
Parameters
Returns
Examples
NSChatAgent agent;
Integer chatSessionId;
String toAssociate;
NSChatSessionEntity res = agent.TransferChatSession(chatSessionId, toAssociate);
UpdateChatTopicUserAgent(Integer,String,NSChatTopicAgent)
Updates a user's role in a chat topic
Declaration
NSChatTopicAgent UpdateChatTopicUserAgent(Integer chatTopicId, String username, NSChatTopicAgent useragent)
Parameters
Returns
Examples
NSChatAgent agent;
Integer chatTopicId;
String username;
NSChatTopicAgent useragent;
NSChatTopicAgent res = agent.UpdateChatTopicUserAgent(chatTopicId, username, useragent);
UpdateChatTopicUserAgent(Integer,NSChatTopicAgent[])
Updates users roles in a chat topic
Declaration
NSChatTopicAgent[] UpdateChatTopicUserAgents(Integer chatTopicId, NSChatTopicAgent[] useragents)
Parameters
Returns
Examples
NSChatAgent agent;
Integer chatTopicId;
NSChatTopicAgent[] useragents;
NSChatTopicAgent[] res = agent.UpdateChatTopicUserAgents(chatTopicId, useragents);