Class NSChatAgent
Chat functions. Manage chat channels, sessions, and messages.
Examples
NSChatAgent agent;
agent.callMethod(arg1, arg2);
Constructors
NSChatAgent()
Chat functions. Manage chat channels, sessions, and messages.
Declaration
NSChatAgent 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) Examples
NSChatAgent agent;
Integer chatSessionId;
NSChatSessionEntity res = agent.AcceptChatSessionTransfer(chatSessionId);
Parameters
| Type | Name | Description |
| Integer | chatSessionId |
Returns
| Type | Description |
| NSChatSessionEntity |
AddChatMessage(Integer,NSChatMessage)
Adds a new message to a chat session
Declaration
NSChatMessage AddChatMessage(Integer chatSessionId, NSChatMessage message) Examples
NSChatAgent agent;
Integer chatSessionId;
NSChatMessage message;
NSChatMessage res = agent.AddChatMessage(chatSessionId, message);
Parameters
| Type | Name | Description |
| Integer | chatSessionId | |
| NSChatMessage | message | The message to add. |
Returns
| Type | Description |
| NSChatMessage |
AddChatTopicUserAgent(Integer,NSChatTopicAgent)
Adds a user to a chat topic
Declaration
NSChatTopicAgent AddChatTopicUserAgent(Integer chatTopicId, NSChatTopicAgent useragent) Examples
NSChatAgent agent;
Integer chatTopicId;
NSChatTopicAgent useragent;
NSChatTopicAgent res = agent.AddChatTopicUserAgent(chatTopicId, useragent);
Parameters
| Type | Name | Description |
| Integer | chatTopicId | |
| NSChatTopicAgent | useragent |
Returns
| Type | Description |
| NSChatTopicAgent |
ChatSessionsForUser()
Gets all chat sessions which this user is a member of.
Declaration
NSChatSessionEntity[] ChatSessionsForUser() Examples
NSChatAgent agent;
NSChatSessionEntity[] res = agent.ChatSessionsForUser();
Returns
| Type | Description |
| NSChatSessionEntity[] |
ChatTopicsForUser()
Gets all chat topics which this user is a member of.nd, Notifications, Listen or Manager.
Declaration
NSChatTopicEntity[] ChatTopicsForUser() Examples
NSChatAgent agent;
NSChatTopicEntity[] res = agent.ChatTopicsForUser();
Returns
| Type | Description |
| NSChatTopicEntity[] |
CreateChatSessionForTopic(Integer)
Creates a new session on a chat topic
Declaration
NSChatSessionEntity CreateChatSessionForTopic(Integer chatTopicId) Examples
NSChatAgent agent;
Integer chatTopicId;
NSChatSessionEntity res = agent.CreateChatSessionForTopic(chatTopicId);
Parameters
| Type | Name | Description |
| Integer | chatTopicId |
Returns
| Type | Description |
| NSChatSessionEntity |
CreateDefaultChatSessionEntity()
Sets default values into a new NSChatSessionEntity.
Declaration
NSChatSessionEntity CreateDefaultChatSessionEntity() Examples
NSChatAgent agent;
NSChatSessionEntity thing = agent.CreateDefaultChatSessionEntity();
thing = agent.SaveChatSessionEntity(thing);
Returns
| Type | Description |
| NSChatSessionEntity |
CreateDefaultChatTopicAgent()
Sets default values into a new NSChatTopicAgent.
Declaration
NSChatTopicAgent CreateDefaultChatTopicAgent() Examples
NSChatAgent agent;
NSChatTopicAgent thing = agent.CreateDefaultChatTopicAgent();
thing = agent.SaveChatTopicAgent(thing);
Returns
| Type | Description |
| NSChatTopicAgent |
CreateDefaultChatTopicEntity()
Sets default values into a new NSChatTopicEntity.
Declaration
NSChatTopicEntity CreateDefaultChatTopicEntity() Examples
NSChatAgent agent;
NSChatTopicEntity thing = agent.CreateDefaultChatTopicEntity();
thing = agent.SaveChatTopicEntity(thing);
Returns
| Type | Description |
| NSChatTopicEntity |
DeleteChatSessionEntity(Integer)
Deletes the NSChatSessionEntity
Declaration
Void DeleteChatSessionEntity(Integer chatSessionEntity) Examples
NSChatAgent agent;
agent.DeleteChatSessionEntity(123);
Parameters
| Type | Name | Description |
| Integer | chatSessionEntity |
Returns
| Type | Description |
| Void |
DeleteChatTopicEntity(Integer)
Deletes the NSChatTopicEntity
Declaration
Void DeleteChatTopicEntity(Integer chatTopicEntity) Examples
NSChatAgent agent;
agent.DeleteChatTopicEntity(123);
Parameters
| Type | Name | Description |
| Integer | chatTopicEntity |
Returns
| Type | Description |
| Void |
DeleteChatTopicUserAgent(Integer,String)
Removes a user from a topic
Declaration
Void DeleteChatTopicUserAgent(Integer chatTopicId, String username) Examples
NSChatAgent agent;
Integer chatTopicId;
String username;
agent.DeleteChatTopicUserAgent(chatTopicId, username);
Parameters
| Type | Name | Description |
| Integer | chatTopicId | |
| String | username |
Returns
| Type | Description |
| Void |
GetChatMessages(Integer,Integer)
Gets all or some of the messages in a chat session
Declaration
NSChatMessage[] GetChatMessages(Integer chatSessionId, Integer after) Examples
NSChatAgent agent;
Integer chatSessionId;
Integer after;
NSChatMessage[] res = agent.GetChatMessages(chatSessionId, after);
Parameters
| Type | Name | Description |
| Integer | chatSessionId | |
| Integer | after |
Returns
| Type | Description |
| NSChatMessage[] |
GetChatPresence()
Gets the chat presence status for all chat users.
Declaration
NSChatPresence[] GetChatPresence() Examples
NSChatAgent agent;
NSChatPresence[] res = agent.GetChatPresence();
Returns
| Type | Description |
| NSChatPresence[] |
GetChatSessionEntity(Integer)
Gets an NSChatSessionEntity object.
Declaration
NSChatSessionEntity GetChatSessionEntity(Integer chatSessionEntityId) Examples
NSChatAgent agent;
NSChatSessionEntity thing = agent.GetChatSessionEntity(123);
Parameters
| Type | Name | Description |
| Integer | chatSessionEntityId |
Returns
| Type | Description |
| NSChatSessionEntity |
GetChatTopicEntity(Integer)
Gets an NSChatTopicEntity object.
Declaration
NSChatTopicEntity GetChatTopicEntity(Integer chatTopicEntityId) Examples
NSChatAgent agent;
NSChatTopicEntity thing = agent.GetChatTopicEntity(123);
Parameters
| Type | Name | Description |
| Integer | chatTopicEntityId |
Returns
| Type | Description |
| NSChatTopicEntity |
GetChatTopicUserAgent(Integer,String)
Gets a user assigned to a topic
Declaration
NSChatTopicAgent GetChatTopicUserAgent(Integer chatTopicId, String username) Examples
NSChatAgent agent;
Integer chatTopicId;
String username;
NSChatTopicAgent res = agent.GetChatTopicUserAgent(chatTopicId, username);
Parameters
| Type | Name | Description |
| Integer | chatTopicId | |
| String | username |
Returns
| Type | Description |
| NSChatTopicAgent |
GetChatTopicUserAgentList(Integer)
Gets a list of users assigned to a chat topic.
Declaration
NSChatTopicAgent[] GetChatTopicUserAgentList(Integer chatTopicId) Examples
NSChatAgent agent;
Integer chatTopicId;
NSChatTopicAgent[] res = agent.GetChatTopicUserAgentList(chatTopicId);
Parameters
| Type | Name | Description |
| Integer | chatTopicId |
Returns
| Type | Description |
| NSChatTopicAgent[] |
GetChatTranscript(Integer,Bool)
Gets the chat transcript, formatted as plain text or HTML.
Declaration
String GetChatTranscript(Integer chatSessionId, Bool html) Examples
NSChatAgent agent;
Integer chatSessionId;
Bool html;
String res = agent.GetChatTranscript(chatSessionId, html);
Parameters
| Type | Name | Description |
| Integer | chatSessionId | |
| Bool | html |
Returns
| Type | Description |
| String | chat transcript, formatted as plain text or HTMl. |
GetUserAgentList(Bool,Bool)
Gets list of users that can be assigned to chat topics.
Declaration
NSMDOListItem[] GetUserAgentList(Bool flat, Bool onlyPresent) Examples
NSChatAgent agent;
Bool flat;
Bool onlyPresent;
NSMDOListItem[] res = agent.GetUserAgentList(flat, onlyPresent);
Parameters
| Type | Name | Description |
| Bool | flat | |
| Bool | onlyPresent |
Returns
| Type | Description |
| NSMDOListItem[] |
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) Examples
NSChatAgent agent;
Integer chatTopicId;
Bool res = agent.IsWithinOpeningHours(chatTopicId);
Parameters
| Type | Name | Description |
| Integer | chatTopicId |
Returns
| Type | Description |
| Bool |
PickUpChatSession(Integer)
Answer the session: assign the session to the user. The welcome message is sent to the customer.
Declaration
NSChatSessionEntity PickUpChatSession(Integer chatSessionId) Examples
NSChatAgent agent;
Integer chatSessionId;
NSChatSessionEntity res = agent.PickUpChatSession(chatSessionId);
Parameters
| Type | Name | Description |
| Integer | chatSessionId |
Returns
| Type | Description |
| NSChatSessionEntity | Returns NULL if session was not in queue. |
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() Examples
NSChatAgent agent;
NSChatSessionEntity res = agent.PickUpFirstChatSession();
Returns
| Type | Description |
| NSChatSessionEntity |
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) Examples
NSChatAgent agent;
Integer chatSessionId;
NSChatSessionEntity res = agent.RejectChatSessionTransfer(chatSessionId);
Parameters
| Type | Name | Description |
| Integer | chatSessionId |
Returns
| Type | Description |
| NSChatSessionEntity |
ResetChatSession(Integer)
Resets chat session, puts it back on the queue for pickup.
Declaration
NSChatSessionEntity ResetChatSession(Integer chatSessionId) Examples
NSChatAgent agent;
Integer chatSessionId;
NSChatSessionEntity res = agent.ResetChatSession(chatSessionId);
Parameters
| Type | Name | Description |
| Integer | chatSessionId |
Returns
| Type | Description |
| NSChatSessionEntity |
SaveChatPresence(NSChatPresence[])
Saves the chat presence for specified users
Declaration
Void SaveChatPresence(NSChatPresence[] chatPresence) Examples
NSChatAgent agent;
NSChatPresence[] chatPresence;
agent.SaveChatPresence(chatPresence);
Parameters
| Type | Name | Description |
| NSChatPresence[] | chatPresence |
Returns
| Type | Description |
| Void |
SaveChatSessionEntity(NSChatSessionEntity)
Updates the existing NSChatSessionEntity or creates a new NSChatSessionEntity if the id parameter is 0
Declaration
NSChatSessionEntity SaveChatSessionEntity(NSChatSessionEntity chatSessionEntity) Examples
NSChat agent;
NSChatSessionEntity thing = agent.CreateDefaultChatSessionEntity();
thing = agent.SaveChatSessionEntity(thing);
Parameters
| Type | Name | Description |
| NSChatSessionEntity | chatSessionEntity |
Returns
| Type | Description |
| NSChatSessionEntity |
SaveChatTopicEntity(NSChatTopicEntity)
Updates the existing NSChatTopicEntity or creates a new NSChatTopicEntity if the id parameter is 0
Declaration
NSChatTopicEntity SaveChatTopicEntity(NSChatTopicEntity chatTopicEntity) Examples
NSChat agent;
NSChatTopicEntity thing = agent.CreateDefaultChatTopicEntity();
thing = agent.SaveChatTopicEntity(thing);
Parameters
| Type | Name | Description |
| NSChatSessionEntity | chatSessionEntity | The NSChatTopicEntity to save. |
Returns
| Type | Description |
| NSChatTopicEntity |
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) Examples
NSChatAgent agent;
Integer chatSessionId;
String toAssociate;
NSChatSessionEntity res = agent.TransferChatSession(chatSessionId, toAssociate);
Parameters
| Type | Name | Description |
| Integer | chatSessionId | |
| String | toAssociate |
Returns
| Type | Description |
| NSChatSessionEntity |
UpdateChatTopicUserAgent(Integer,String,NSChatTopicAgent)
Updates a user's role in a chat topic
Declaration
NSChatTopicAgent UpdateChatTopicUserAgent(Integer chatTopicId, String username, NSChatTopicAgent useragent) Examples
NSChatAgent agent;
Integer chatTopicId;
String username;
NSChatTopicAgent useragent;
NSChatTopicAgent res = agent.UpdateChatTopicUserAgent(chatTopicId, username, useragent);
Parameters
| Type | Name | Description |
| Integer | chatTopicId | |
| String | username | |
| NSChatTopicAgent | useragent |
Returns
| Type | Description |
| NSChatTopicAgent |
UpdateChatTopicUserAgent(Integer,NSChatTopicAgent[])
Updates users roles in a chat topic
Declaration
NSChatTopicAgent[] UpdateChatTopicUserAgents(Integer chatTopicId, NSChatTopicAgent[] useragents) Examples
NSChatAgent agent;
Integer chatTopicId;
NSChatTopicAgent[] useragents;
NSChatTopicAgent[] res = agent.UpdateChatTopicUserAgents(chatTopicId, useragents);
Parameters
| Type | Name | Description |
| Integer | chatTopicId | |
| NSChatTopicAgent[] | useragents |
Returns
| Type | Description |
| NSChatTopicAgent[] |