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.
Introduced or updated in version: 8.5R08
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.
Introduced or updated in version: 8.5R08
Declaration
NSChatSessionEntity AcceptChatSessionTransfer(Integer chatSessionId)
Parameters
Type | Name | Description |
---|---|---|
Integer | chatSessionId |
Returns
Type | Description |
---|---|
NSChatSessionEntity |
Examples
NSChatAgent agent;
Integer chatSessionId;
NSChatSessionEntity res = agent.AcceptChatSessionTransfer(chatSessionId);
AddChatMessage(Integer,NSChatMessage)
Adds a new message to a chat session
Introduced or updated in version: 8.5R08
Declaration
NSChatMessage AddChatMessage(Integer chatSessionId, NSChatMessage message)
Parameters
Type | Name | Description |
---|---|---|
Integer | chatSessionId | |
NSChatMessage | message) | The message to add. |
Returns
Type | Description |
---|---|
NSChatMessage |
Examples
NSChatAgent agent;
Integer chatSessionId;
NSChatMessage message;
NSChatMessage res = agent.AddChatMessage(chatSessionId, message);
AddChatTopicUserAgent(Integer,NSChatTopicAgent)
Adds a user to a chat topic
Introduced or updated in version: 8.5R08
Declaration
NSChatTopicAgent AddChatTopicUserAgent(Integer chatTopicId, NSChatTopicAgent useragent)
Parameters
Type | Name | Description |
---|---|---|
Integer | chatTopicId | |
NSChatTopicAgent | useragent |
Returns
Type | Description |
---|---|
NSChatTopicAgent |
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.
Introduced or updated in version: 8.5R08
Declaration
NSChatSessionEntity[] ChatSessionsForUser()
Returns
Type | Description |
---|---|
NSChatSessionEntity[] |
Remarks
Members means that you have at least one of: Can Respond, Notifications, Listen or Manager
Examples
NSChatAgent agent;
NSChatSessionEntity[] res = agent.ChatSessionsForUser();
ChatTopicsForUser()
Gets all chat topics which this user is a member of.nd, Notifications, Listen or Manager.
Introduced or updated in version: 8.5R08
Declaration
NSChatTopicEntity[] ChatTopicsForUser()
Returns
Type | Description |
---|---|
NSChatTopicEntity[] |
Remarks
Members means that you have at least one of: Can Respond, Notifications, Listen or Manager
Examples
NSChatAgent agent;
NSChatTopicEntity[] res = agent.ChatTopicsForUser();
CreateChatSessionForTopic(Integer)
Creates a new session on a chat topic
Introduced or updated in version: 8.5R08
Declaration
NSChatSessionEntity CreateChatSessionForTopic(Integer chatTopicId)
Parameters
Type | Name | Description |
---|---|---|
Integer | chatTopicId |
Returns
Type | Description |
---|---|
NSChatSessionEntity |
Examples
NSChatAgent agent;
Integer chatTopicId;
NSChatSessionEntity res = agent.CreateChatSessionForTopic(chatTopicId);
CreateDefaultChatSessionEntity()
Sets default values into a new NSChatSessionEntity.
Introduced or updated in version: 8.5R08
Declaration
NSChatSessionEntity CreateDefaultChatSessionEntity()
Returns
Type | Description |
---|---|
NSChatSessionEntity |
Remarks
NetServer calculates default values (for example Country) on the entity, which is required when creating/storing a new instance
Examples
NSChatAgent agent;
NSChatSessionEntity thing = agent.CreateDefaultChatSessionEntity();
thing = agent.SaveChatSessionEntity(thing);
CreateDefaultChatTopicAgent()
Sets default values into a new NSChatTopicAgent.
Introduced or updated in version: 8.5R08
Declaration
NSChatTopicAgent CreateDefaultChatTopicAgent()
Returns
Type | Description |
---|---|
NSChatTopicAgent |
Remarks
NetServer calculates default values (for example Country) on the entity, which is required when creating/storing a new instance
Examples
NSChatAgent agent;
NSChatTopicAgent thing = agent.CreateDefaultChatTopicAgent();
thing = agent.SaveChatTopicAgent(thing);
CreateDefaultChatTopicEntity()
Sets default values into a new NSChatTopicEntity.
Introduced or updated in version: 8.5R08
Declaration
NSChatTopicEntity CreateDefaultChatTopicEntity()
Returns
Type | Description |
---|---|
NSChatTopicEntity |
Remarks
NetServer calculates default values (for example Country) on the entity, which is required when creating/storing a new instance
Examples
NSChatAgent agent;
NSChatTopicEntity thing = agent.CreateDefaultChatTopicEntity();
thing = agent.SaveChatTopicEntity(thing);
DeleteChatSessionEntity(Integer)
Deletes the NSChatSessionEntity
Introduced or updated in version: 8.5R08
Declaration
Void DeleteChatSessionEntity(Integer chatSessionEntity)
Parameters
Type | Name | Description |
---|---|---|
Integer | chatSessionEntity |
Returns
Type | Description |
---|---|
Void |
Examples
NSChatAgent agent;
agent.DeleteChatSessionEntity(123);
DeleteChatTopicEntity(Integer)
Deletes the NSChatTopicEntity
Introduced or updated in version: 8.5R08
Declaration
Void DeleteChatTopicEntity(Integer chatTopicEntity)
Parameters
Type | Name | Description |
---|---|---|
Integer | chatTopicEntity |
Returns
Type | Description |
---|---|
Void |
Examples
NSChatAgent agent;
agent.DeleteChatTopicEntity(123);
DeleteChatTopicUserAgent(Integer,String)
Removes a user from a topic
Introduced or updated in version: 8.5R08
Declaration
Void DeleteChatTopicUserAgent(Integer chatTopicId, String username)
Parameters
Type | Name | Description |
---|---|---|
Integer | chatTopicId | |
String | username |
Returns
Type | Description |
---|---|
Void |
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
Introduced or updated in version: 8.5R08
Declaration
NSChatMessage[] GetChatMessages(Integer chatSessionId, Integer after)
Parameters
Type | Name | Description |
---|---|---|
Integer | chatSessionId | |
Integer | after |
Returns
Type | Description |
---|---|
NSChatMessage[] |
Examples
NSChatAgent agent;
Integer chatSessionId;
Integer after;
NSChatMessage[] res = agent.GetChatMessages(chatSessionId, after);
GetChatPresence()
Gets the chat presence status for all chat users.
Introduced or updated in version: 8.5R08
Declaration
NSChatPresence[] GetChatPresence()
Returns
Type | Description |
---|---|
NSChatPresence[] |
Examples
NSChatAgent agent;
NSChatPresence[] res = agent.GetChatPresence();
GetChatSessionEntity(Integer)
Gets an NSChatSessionEntity object.
Introduced or updated in version: 8.5R08
Declaration
NSChatSessionEntity GetChatSessionEntity(Integer chatSessionEntityId)
Parameters
Type | Name | Description |
---|---|---|
Integer | chatSessionEntityId |
Returns
Type | Description |
---|---|
NSChatSessionEntity |
Examples
NSChatAgent agent;
NSChatSessionEntity thing = agent.GetChatSessionEntity(123);
GetChatTopicEntity(Integer)
Gets an NSChatTopicEntity object.
Introduced or updated in version: 8.5R08
Declaration
NSChatTopicEntity GetChatTopicEntity(Integer chatTopicEntityId)
Parameters
Type | Name | Description |
---|---|---|
Integer | chatTopicEntityId |
Returns
Type | Description |
---|---|
NSChatTopicEntity |
Examples
NSChatAgent agent;
NSChatTopicEntity thing = agent.GetChatTopicEntity(123);
GetChatTopicUserAgent(Integer,String)
Gets a user assigned to a topic
Introduced or updated in version: 8.5R08
Declaration
NSChatTopicAgent GetChatTopicUserAgent(Integer chatTopicId, String username)
Parameters
Type | Name | Description |
---|---|---|
Integer | chatTopicId | |
String | username |
Returns
Type | Description |
---|---|
NSChatTopicAgent |
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.
Introduced or updated in version: 8.5R08
Declaration
NSChatTopicAgent[] GetChatTopicUserAgentList(Integer chatTopicId)
Parameters
Type | Name | Description |
---|---|---|
Integer | chatTopicId |
Returns
Type | Description |
---|---|
NSChatTopicAgent[] |
Examples
NSChatAgent agent;
Integer chatTopicId;
NSChatTopicAgent[] res = agent.GetChatTopicUserAgentList(chatTopicId);
GetChatTranscript(Integer,Bool)
Gets the chat transcript, formatted as plain text or HTML.
Introduced or updated in version: 8.5R08
Declaration
String GetChatTranscript(Integer chatSessionId, Bool html)
Parameters
Type | Name | Description |
---|---|---|
Integer | chatSessionId | |
Bool | html |
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.
Introduced or updated in version: 8.5R08
Declaration
NSMDOListItem[] GetUserAgentList(Bool flat, Bool onlyPresent)
Parameters
Type | Name | Description |
---|---|---|
Bool | flat | |
Bool | onlyPresent |
Returns
Type | Description |
---|---|
NSMDOListItem[] |
Remarks
Users with Chat-CALs from the MDO list 'chatuser'
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.
Introduced or updated in version: 8.5R08
Declaration
Bool IsWithinOpeningHours(Integer chatTopicId)
Parameters
Type | Name | Description |
---|---|---|
Integer | chatTopicId |
Returns
Type | Description |
---|---|
Bool |
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.
Introduced or updated in version: 8.5R08
Declaration
NSChatSessionEntity PickUpChatSession(Integer chatSessionId)
Parameters
Type | Name | Description |
---|---|---|
Integer | chatSessionId |
Returns
Type | Description |
---|---|
NSChatSessionEntity | Returns NULL if session was not in queue. |
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.
Introduced or updated in version: 8.5R08
Declaration
NSChatSessionEntity PickUpFirstChatSession()
Returns
Type | Description |
---|---|
NSChatSessionEntity |
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.
Introduced or updated in version: 8.5R08
Declaration
NSChatSessionEntity RejectChatSessionTransfer(Integer chatSessionId)
Parameters
Type | Name | Description |
---|---|---|
Integer | chatSessionId |
Returns
Type | Description |
---|---|
NSChatSessionEntity |
Examples
NSChatAgent agent;
Integer chatSessionId;
NSChatSessionEntity res = agent.RejectChatSessionTransfer(chatSessionId);
ResetChatSession(Integer)
Resets chat session, puts it back on the queue for pickup.
Introduced or updated in version: 8.5R08
Declaration
NSChatSessionEntity ResetChatSession(Integer chatSessionId)
Parameters
Type | Name | Description |
---|---|---|
Integer | chatSessionId |
Returns
Type | Description |
---|---|
NSChatSessionEntity |
Remarks
Used by bots to hand off a session to human
Examples
NSChatAgent agent;
Integer chatSessionId;
NSChatSessionEntity res = agent.ResetChatSession(chatSessionId);
SaveChatPresence(NSChatPresence[])
Saves the chat presence for specified users
Introduced or updated in version: 8.5R08
Declaration
Void SaveChatPresence(NSChatPresence[] chatPresence)
Parameters
Type | Name | Description |
---|---|---|
NSChatPresence[] | chatPresence |
Returns
Type | Description |
---|---|
Void |
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
Introduced or updated in version: 8.5R08
Declaration
NSChatSessionEntity SaveChatSessionEntity(NSChatSessionEntity chatSessionEntity)
Parameters
Type | Name | Description |
---|---|---|
NSChatSessionEntity | chatSessionEntity |
Returns
Type | Description |
---|---|
NSChatSessionEntity |
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
Introduced or updated in version: 8.5R08
Declaration
NSChatTopicEntity SaveChatTopicEntity(NSChatTopicEntity chatTopicEntity)
Parameters
Type | Name | Description |
---|---|---|
NSChatSessionEntity | chatSessionEntity | The NSChatTopicEntity to save. |
Returns
Type | Description |
---|---|
NSChatTopicEntity |
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.
Introduced or updated in version: 8.5R08
Declaration
NSChatSessionEntity TransferChatSession(Integer chatSessionId, String toAssociate)
Parameters
Type | Name | Description |
---|---|---|
Integer | chatSessionId | |
String | toAssociate |
Returns
Type | Description |
---|---|
NSChatSessionEntity |
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
Introduced or updated in version: 8.5R08
Declaration
NSChatTopicAgent UpdateChatTopicUserAgent(Integer chatTopicId, String username, NSChatTopicAgent useragent)
Parameters
Type | Name | Description |
---|---|---|
Integer | chatTopicId | |
String | username | |
NSChatTopicAgent | useragent |
Returns
Type | Description |
---|---|
NSChatTopicAgent |
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
Introduced or updated in version: 8.5R08
Declaration
NSChatTopicAgent[] UpdateChatTopicUserAgents(Integer chatTopicId, NSChatTopicAgent[] useragents)
Parameters
Type | Name | Description |
---|---|---|
Integer | chatTopicId | |
NSChatTopicAgent[] | useragents |
Returns
Type | Description |
---|---|
NSChatTopicAgent[] |
Examples
NSChatAgent agent;
Integer chatTopicId;
NSChatTopicAgent[] useragents;
NSChatTopicAgent[] res = agent.UpdateChatTopicUserAgents(chatTopicId, useragents);