Interface ICustomerServiceAgent
Interface for the CustomerService Agent Agent used for Customer Service methods
Namespace: SuperOffice.CRM.Services
Assembly: SuperOffice.Services.dll
Syntax
[Agent("CustomerService Agent", "Interface for the CustomerService Agent. Agent used for Customer Service methods")]
public interface ICustomerServiceAgent : IAgent
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (CustomerServiceAgent agent = new CustomerServiceAgent())
{
// call methods on agent here...
}
}
Methods
AddMessageFromMailDataAsync(int, string, CancellationToken)
This method will add a message to an existing request in the sam way as importMail would do it from an email. It accepts RFC822 formatted data
Declaration
Task<TicketInfo> AddMessageFromMailDataAsync(int ticketId, string data, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | ticketId | The id of the ticket to add a message |
string | data | RFC822 formatted data to import as a message |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<TicketInfo> | An object containing some meta data for the ticket |
ChatSessionsForUserAsync(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
Task<ChatSession[]> ChatSessionsForUserAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<ChatSession[]> | Array of chat TOPIC ids the current user can access. NOT chat sessions. |
CheckIfCustomizedTemplatesAsync(CancellationToken)
Checks whether the core html templates are customized
Declaration
Task<bool> CheckIfCustomizedTemplatesAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<bool> | True if the templates are customized |
CheckSymmetricEncryptionAsync(string, CancellationToken)
Do a test to check that we are using the same encryption keys
Declaration
Task<string> CheckSymmetricEncryptionAsync(string encryptedString, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | encryptedString | An encrypted version of the string |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<string> | Encrypted version of the string done by NetServer |
CreateDefaultCustomerCenterConfigAsync(CancellationToken)
Loading default values into a new CustomerCenterConfig. NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance
Declaration
Task<CustomerCenterConfig> CreateDefaultCustomerCenterConfigAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<CustomerCenterConfig> | New CustomerCenterConfig with default values |
CreateDefaultMailboxEntityAsync(CancellationToken)
Loading default values into a new MailboxEntity. NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance
Declaration
Task<MailboxEntity> CreateDefaultMailboxEntityAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<MailboxEntity> | New MailboxEntity with default values |
CreateSessionAsync(string, CancellationToken)
Creates a login session for a CS user
Declaration
Task<CsSessionKey> CreateSessionAsync(string remoteIp, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | remoteIp | The ip of the client creating the session |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<CsSessionKey> | The session key information |
CreateTicketFromMailDataAsync(int, string, CancellationToken)
This method create a new ticket in the same way as importMail would import an email. It accepts RFC822 formatted data
Declaration
Task<TicketInfo> CreateTicketFromMailDataAsync(int mailboxId, string data, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | mailboxId | The id of the Service mailbox |
string | data | RFC822 formatted data to import as a ticket |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<TicketInfo> | An object containing some meta data for the created ticket |
DeleteChatSessionsAsync(int[], CancellationToken)
Deletes the specified chat sessions.
Declaration
Task DeleteChatSessionsAsync(int[] ids, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int[] | ids | The ids of the chat sessions to delete |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | This method has no return value |
DeleteCustomerCenterConfigAsync(int, CancellationToken)
Deletes the CustomerCenterConfig
Declaration
Task DeleteCustomerCenterConfigAsync(int customerCenterConfigId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | customerCenterConfigId | The identity of the CustomerCenterConfig |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
EventHandlerExistsAsync(EventHandlerType, CancellationToken)
Check if an eventhandler exists for a given enum
Declaration
Task<bool> EventHandlerExistsAsync(EventHandlerType eventHandlerType, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
EventHandlerType | eventHandlerType | The EventHandlerType we are checking |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<bool> | True if it exists |
EventHandlersExistsAsync(EventHandlerType[], CancellationToken)
Check if any given eventhandler exists
Declaration
Task<EventHandlerType[]> EventHandlersExistsAsync(EventHandlerType[] eventHandlerTypes, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
EventHandlerType[] | eventHandlerTypes | The EventHandlerTypes we are checking |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<EventHandlerType[]> | The existing event handlers |
ExecuteEventHandlersAsync(EventData, CancellationToken)
This method will execute event handlers in CRMScript for a given event.
Declaration
Task<EventData> ExecuteEventHandlersAsync(EventData eventData, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
EventData | eventData | The EventData instance sent to the event handler |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<EventData> | The EventData instance after event handler execution |
FindTicketsByTitleOrIdAsync(string, int, CancellationToken)
This method wil search for tickets matching title or id
Declaration
Task<TicketInfo[]> FindTicketsByTitleOrIdAsync(string titleOrId, int maxRows, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | titleOrId | The search string. If this is a number, it will also search for a matching ticket id |
int | maxRows | The maximum number of rows to be returned |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<TicketInfo[]> | An array of objects containing some meta data for matching tickets |
GetAllCustomerCenterConfigsAsync(CancellationToken)
Get all rows from cust_config as an array of CustomerCenterConfig entities
Declaration
Task<CustomerCenterConfig[]> GetAllCustomerCenterConfigsAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<CustomerCenterConfig[]> | An array of CustomerCenterConfig entities |
GetCustomerCenterConfigAsync(int, CancellationToken)
Gets a CustomerCenterConfig object.
Declaration
Task<CustomerCenterConfig> GetCustomerCenterConfigAsync(int customerCenterConfigId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | customerCenterConfigId | The identifier of the CustomerCenterConfig object |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<CustomerCenterConfig> | CustomerCenterConfig |
GetCustomerServiceStartupAsync(CancellationToken)
Get the carrier with data that Service needs when starting up
Declaration
Task<CustomerServiceStartup> GetCustomerServiceStartupAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<CustomerServiceStartup> | The carrier containing the startup data |
GetCustomerServiceStartupByOwnerAsync(int, CancellationToken)
Get the carrier with data that Service needs when starting up for a specific user
Declaration
Task<CustomerServiceStartup> GetCustomerServiceStartupByOwnerAsync(int userId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | userId | The user for which we want to fetch the startup values for |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<CustomerServiceStartup> | The carrier containing the startup data |
GetFaqForCustomerAsync(int, CancellationToken)
Get a FAQ entry, ment to be displayed for a customer. This can either be a link to the FAQ entry on Custom Center, or it can be the answer and question. This is dependent on Registry setting with reg_id=157
Declaration
Task<string> GetFaqForCustomerAsync(int faqEntryId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | faqEntryId | The id of the FAQ entry to get. Only FAQ entries with access level public (both for unauthenticated and autenticated customer) will be returned |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<string> | The FAQ to show to the customer. Either a clickable link or the question/answer itself. |
GetMailboxEntityAsync(int, CancellationToken)
Gets a MailboxEntity object.
Declaration
Task<MailboxEntity> GetMailboxEntityAsync(int mailboxEntityId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | mailboxEntityId | The identifier of the MailboxEntity object |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<MailboxEntity> | MailboxEntity |
GetMailboxesAsync(CancellationToken)
This method will get all registered mailboxes in Service
Declaration
Task<Mailbox[]> GetMailboxesAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<Mailbox[]> | An array of Mailbox objects |
GetParsedTemplateAsync(int, int, int, int, CancellationToken)
Get a specific langauge version of the reply template, and run this trough the parser
Declaration
Task<ReplyTemplateParsed> GetParsedTemplateAsync(int replyTemplateId, int languageId, int personId, int ticketId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | replyTemplateId | The id of the reply template |
int | languageId | The language id (prefered language). If 0 is given, the language of the person will be used |
int | personId | The id of the person that will be populated into the parser |
int | ticketId | The id of the ticket that will be populated into the parser |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<ReplyTemplateParsed> | The parsed reply template |
GetPreviewFaqEntryAsync(int, CancellationToken)
Get a faq entry from its faq entry id
Declaration
Task<PreviewFaqEntry> GetPreviewFaqEntryAsync(int kbEntryId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | kbEntryId | FAQ entry ID |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<PreviewFaqEntry> | FAQ entry suitable for preview |
GetPreviewQuickReplyAsync(int, CancellationToken)
Get a quick reply from its quick reply id
Declaration
Task<PreviewQuickReply> GetPreviewQuickReplyAsync(int quickReplyId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | quickReplyId | Quick reply ID |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<PreviewQuickReply> | Quick reply suitable for preview |
GetPreviewReplyTemplateAsync(int, CancellationToken)
Get a reply template from its reply template id
Declaration
Task<PreviewReplyTemplate> GetPreviewReplyTemplateAsync(int replyTemplateId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | replyTemplateId | Reply template ID |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<PreviewReplyTemplate> | Reply template suitable for preview |
GetProgramUrlAsync(string, bool, CancellationToken)
This method will convert a module name into a Service URL.
Declaration
Task<string> GetProgramUrlAsync(string programName, bool external, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | programName | In this parameter you must specify which CS program you want to create an URL for. Valid examples are "ticket", "rms", "spm" etc. |
bool | external | If set to true, this will generate URLs that are accesible from the outside (for example Internet) |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<string> | Returns a valid Service URL composed of the give parameters. |
GetSmsConfigAsync(CancellationToken)
Get the SmsConfig settings for Customer Service sms providers.
Declaration
Task<SmsConfig> GetSmsConfigAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<SmsConfig> | Current SMS configuration. |
GetStatisticsAsync(StatusScreenPanelType[], CancellationToken)
Returns the calculated results for the required statistics for the Customer Service Status Page
Declaration
Task<StatisticsDataSet[]> GetStatisticsAsync(StatusScreenPanelType[] functions, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
StatusScreenPanelType[] | functions | List of functions to calculate and return |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<StatisticsDataSet[]> | Array of StatisticsDataSet |
GetSystemTemplateSettingsAsync(CancellationToken)
Returns system template settings
Declaration
Task<SystemTemplateSettings> GetSystemTemplateSettingsAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<SystemTemplateSettings> | System template settings item |
GetUnparsedTemplateAsync(int, int, CancellationToken)
Get a specific langauge version of the reply template. No parsing is performed.
Declaration
Task<ReplyTemplateParsed> GetUnparsedTemplateAsync(int replyTemplateId, int languageId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | replyTemplateId | The id of the reply template |
int | languageId | The language id (prefered language). If 0 is given, the language of the person will be used |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<ReplyTemplateParsed> | The unparsed reply template, but using the same return data structure |
HasChatNotifyAsync(CancellationToken)
Check if user has any chat notification
Declaration
Task<bool> HasChatNotifyAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<bool> | True if the user has at least one notification setting on |
RemoveSessionAsync(int, CancellationToken)
Remove a login session for a CS user
Declaration
Task RemoveSessionAsync(int loginId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | loginId | The login id to remove |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
ReportSessionActiveAsync(string, CancellationToken)
Report a session as being 'active'; will update the corresponding row in login table, but not more than once per minute/session
Declaration
Task<int> ReportSessionActiveAsync(string sessionKey, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | sessionKey | CS session key, matching the 'login' table |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<int> | The ID of the login table row, or 0 if not found |
SaveAllCustomerCenterConfigsAsync(CustomerCenterConfig[], CancellationToken)
Save an array of CustomerCenterConfig entities to the database
Declaration
Task SaveAllCustomerCenterConfigsAsync(CustomerCenterConfig[] custConfigs, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CustomerCenterConfig[] | custConfigs | The CustomerCenterConfig entities to be saved. If the id does not exists, a new one will be created. Unknown ids will be skipped |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | void |
SaveCustomerCenterConfigAsync(CustomerCenterConfig, CancellationToken)
Updates the existing CustomerCenterConfig or creates a new CustomerCenterConfig if the id parameter is empty
Declaration
Task<CustomerCenterConfig> SaveCustomerCenterConfigAsync(CustomerCenterConfig customerCenterConfig, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CustomerCenterConfig | customerCenterConfig | The CustomerCenterConfig that is saved. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<CustomerCenterConfig> | New or updated CustomerCenterConfig |
SaveMailboxEntityAsync(MailboxEntity, CancellationToken)
Updates the existing MailboxEntity or creates a new MailboxEntity if the id parameter is empty
Declaration
Task<MailboxEntity> SaveMailboxEntityAsync(MailboxEntity mailboxEntity, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
MailboxEntity | mailboxEntity | The MailboxEntity that is saved. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<MailboxEntity> | New or updated MailboxEntity |
SaveSystemTemplateSettingsAsync(SystemTemplateSettings, CancellationToken)
Saves and validates updated system templates. Throws exception if validation fails
Declaration
Task<SystemTemplateSettings> SaveSystemTemplateSettingsAsync(SystemTemplateSettings systemTemplateSettings, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
SystemTemplateSettings | systemTemplateSettings | System template settings item with updated values |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<SystemTemplateSettings> | Updated system template settings |
SessionIsValidAsync(string, CancellationToken)
Check if a CS session is valid
Declaration
Task<bool> SessionIsValidAsync(string csSessionKey, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | csSessionKey | The CS session key to check |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<bool> | True if there is a valid CS session based on the session key |
TestSmtpServerAsync(string, string, bool, CancellationToken)
This method will do a test of a SMTP account, by sending an email to a special @superoffice.com account
Declaration
Task<SmtpTestResult> TestSmtpServerAsync(string smtpUri, string from, bool useStoredPassword, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | smtpUri | An URI containing information to connect to the SMTP server, eg. smtps://myuser:mypassword@smtp.myserver.com:465. Note that username and password must be url encoded |
string | from | The from-address used in the test |
bool | useStoredPassword | Use database persisted password |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<SmtpTestResult> | Contains the result of the test |
UpdateFeatureTogglesAsync(CsFeatureToggle[], CancellationToken)
Update the cached FeatureToggles for CS
Declaration
Task UpdateFeatureTogglesAsync(CsFeatureToggle[] featureToggles, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CsFeatureToggle[] | featureToggles | Feature toggle name / state |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |