CTI integration with Web Client
This article describes how to send a notification to a phone user in Web Client.
The Talisma Web Notification Server service is a WCF service which exposes the IPostNotification service contract. This service allows us to send a phone notification to initiate a new phone session.
The method exposed as part of this contract is:
NotificationResponse PostNotification(NotificationRequest notificationRequest);
Input:
NotificationRequest
The following properties are available in the NotificationRequest class:
Property |
Description |
---|---|
UserId |
User to whom the phone session needs to be sent. |
MediaType |
Must be passed as 1. |
NotificationData |
The details of the phone session are specified in this property. The structure is described in the following table. |
NotificationData
The following properties are available in the NotificationData class:
Property |
Description |
---|---|
ObjectType |
The object type of the record which is viewed in the item view pane of the Phone Workspace. |
ObjectId |
The ID of the record which is viewed in the item view pane of the Phone Workspace. For Account and Interaction, this must be -1. |
AccountId |
The ID of the Account record viewed in the item view pane of the Phone Workspace. This property is used only when the value of the ObjectType property is 2. |
CaseId
|
The ID of the Interaction which is viewed in the item view pane of the Phone Workspace. This property is used only when the value of the ObjectType property is 7. |
CustomList
|
This property is used when the value of the ObjectType property is 3 (Contact). This property passes custom information that is used for resolving a Contact. This data is a list of CustomData. CustomData is described in the next table. |
IsLogCaseMandatory
|
Indicates whether logging an Interaction is mandatory in the active phone session. Default value: false. |
PayLoad
|
Used to send property values for the Message and Interaction objects. This data is a list of PayLoadData, and is described after the CustomData table. |
ScriptId |
The ID of the script that is loaded when the Phone session is launched. |
SessionId |
Passed as -1. (For Internal Use) |
ChangeInteractionNotes |
Passed as -1. (For Internal Use) |
SessionMode |
Passed as -1. (For Internal Use) |
CreatePreview |
Passed as -1. (For Internal Use) |
CustomData
The following properties are available in the CustomData class:
Property |
Description |
---|---|
Key |
The key for the data element. |
Value |
The value passed against the Key. |
PayLoad Data
The following properties are available in the PayLoadData class:
Property |
Description |
---|---|
ObjectType |
Object Type for which property values need to be set. For the Interaction object, this must be 7; for the Message object, this must be 26. |
PropertyDataList |
List of property values. This data is a list of PropertyData, and is described in the following table. |
Property Data
The following properties are available in the PropertyData class
Property |
Description |
---|---|
PropertyId |
Id of the property to be saved. |
PropertyValue |
Property value. |
Output:
NotificationResponse
The following properties are available in the NotificationResponse class
Property |
Description |
---|---|
JsonString |
Returns notification data that is sent as part of the phone session. This data is returned in the form of a Json file. |
StatusCode |
Returns the status of the request. The value 0 indicates success, and a negative value indicates failure. |
ErrorMessage |
Fetches the error message when the request failed. |
InnerException |
Exception details if any exception occurs while sending the request. |
Sample Code:
The following code sample sends a notification to user Id 2. The credentials must be set to a valid CRM user.
NtfnPost.PostNotificationClient clientPost = new PostNotificationClient();
clientPost.ClientCredentials.UserName.UserName = "username";
clientPost.ClientCredentials.UserName.Password = "password";
NtfnPost.NotificationResponse response = new NotificationResponse();
NtfnPost.NotificationRequest request = new NtfnPost.NotificationRequest();
NtfnPost.NotificationData ntfnData = new NtfnPost.NotificationData();
request.UserId = 2;
request.MediaType = 1;
ntfnData.ObjectType = 20005;
ntfnData.AccountId = -1; ntfnData.CaseId = -1;
ntfnData.IsLogCaseMandatory = true;
ntfnData.ScriptId = -1;
ntfnData.SessionId = -1;
ntfnData.ObjectId = 10;
ntfnData.ChangeInteractionNotes = null;
ntfnData.CreatePreview = null;
//The below code is when popup dialog need to be set
ntfnData.CustomList = new NtfnPost.CustomData[]{ new NtfnPost.CustomData(){Key = "Key",Value= "value"}};
//This for when popup dialog need not be set
//ntfnData.CustomList = null;
ntfnData.PayLoad = new NtfnPost.PayLoadData[]
{
new NtfnPost.PayLoadData()
{
ObjectType = 26,
PropertyDataList = new NtfnPost.PropertyData[]
{
new NtfnPost.PropertyData(){PropertyId = 2000104, PropertyValue = "ANI - 101" },
new NtfnPost.PropertyData(){PropertyId = 2000105, PropertyValue = "DNI - 101" }
}
}
};
request.NotificationData = ntfnData;
response = clientPost.PostNotification(request);