Interaction Mobilizer is a software development kit (SDK) that lets you build mobile apps with your own development tool, then connect them to CIC. You may use Interaction Mobilizer to:
• Create a callback.
• Create a chat.
• Launch or update processes using Interaction Process Automation (IPA).
Interaction Web Tools has all the features needed to work with Interaction Mobilizer.
Chapters 1 to 6 show how to use the features. This chapter gives code examples for iOS and JavaScript (Phonegap).
Example: Mobilizer with iOS Apps
This code example shows how to use Apple's Objective C language to work with Interaction Mobilizer.
NSString *userName = @"john.doe";
NSDictionary *dict = @{
@"target": @"Insurance Claims", @"targettype": @"Workgroup", @"subject": @"Claim callback", @"participant": @{
@"name": userName, @"credentials": @{
@"username": @"<< insert user name here>>", @"password": @"<<insert password here>>"
},
@"telephone": @"<<number to call>>"
},
@"customInfo": @"<<some description>>", @"attributes": @{
@"some_name" : @"some_string",
@"some_other_name" : @"some_other_string"
},
@"language": @"en-us"
};
NSError *error = nil;
NSData *jsonInputData = [NSJSONSerialization dataWithJSONObject:dict options:NSJSONWritingPrettyPrinted error:&error];
NSString *jsonInputString = [[NSString alloc] initWithData:jsonInputData encoding:NSUTF8StringEncoding];
Interaction Web Tools Developer's Guide 53 NSURL *url = [NSURL
URLWithString:@"https://webportal.simdomain.com/i3root/server1/websvcs/callba ck/create"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPMethod:@"POST"];
[request setValue:@"application/json; charset=utf-8"
forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:[jsonInputString dataUsingEncoding:NSUTF8StringEncoding]];
NSURLResponse *response;
NSError *err;
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err];
NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
Example: Mobilizer with Phonegap Apps
This code example shows how to use JavaScript to work with Interaction Mobilizer.
<!DOCTYPE html>
<html>
<head>
<title>Mobilizer Callback Example</title>
<link rel="stylesheet" type="text/css" href="css/index.css"/>
<script src="http://code.jquery.com/jquery-latest.min.js"
type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$("#myButton").click(function(){
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8", data: '{"target": "Insurance Claims",
"targettype":"Workgroup","subject":"Claim callback",
"participant": {"name":"John Doe",
"credentials":{"username":"<< user name here>>",
"password":"<<insert password here>>"},
"telephone":"5555555"},
"customInfo":"free-form text","attributes":
{"some_name":"some_string","some_other_name":
"some_other_string"},
"language":"en-us"}',
dataType: "json",
Interaction Web Tools Developer's Guide 54 url:
"https://webportal.simdomain.com/i3root/server1/websvcs/callback/create", success: function(response){
alert(JSON.stringify(response));
} });
});
});
</script>
</head>
<body>
<br/><br/>
<input type="button" value="Get Callback" id="myButton"/>
</body>
</html>
Interaction Web Tools Developer's Guide 55
Appendix A: Sample Session
This appendix gives a complete network transcript of a sample chat.
Request Response Description
GET /websvcs/serverConfiguration
HTTP/1.0 [ { "serverConfiguration": {
"cfgVer": 1 ,"capabilities": {
"chat": [ "start" , "reconnect" ,
"poll" , "setTypingState" ,
"sendMessage" , "exit" ,
"supportAuthenticationTracker" ,
"supportAuthenticationAnonymou s" ] ,"callback": [ "create" ,
"reconnect" , "status" ,
"disconnect" , "properties" ,
"modify" ,
"supportAuthenticationTracker" ,
"supportAuthenticationAnonymou s" ] ,"queueQuery": [
"supportAuthenticationTracker" ,
"supportAuthenticationAnonymou s" ] ,"common": [
"supportRegistrationTracker" ,
"partyInfo" , "problemReport" ] } ,"failoverURIs": [ ]
POST /websvcs/chat/start HTTP/1.0 {"supportedContentTypes":
"text/plain", "participant": {"name":
"John Doe", "credentials": ""},
"target": "Marketing", "targetType":
"Workgroup", "clientToken":
"deprecated", “language”: “en-us”
}
{ "chat": { "pollWaitSuggestion":
2000 , “cfgVer”: 1,
"participantID": "94e8c3b0-aeee-40e1-ba5a-a593c8047fc5",
“dateFormat”: “M\/d\/yyyy”,
“timeFormat”: “h:mm:ss tt”,
“chatID”: “73db8632-9ee8-459e-a193-4d25684499d0” ,"status":
{ "type": "success" } } } new participant ID on the
Interaction Web Tools Developer's Guide 56
Request Response Description
other IC server.
GET /websvcs/chat/poll/94e8c3b0-aeee-40e1-ba5a-a593c8047fc5 HTTP/1.0
{ "chat": { "pollWaitSuggestion":
2000 , “cfgVer”: 1,"events": [ {
"type":
"participantStateChanged"
,"participantID": "94e8c3b0-aeee-40e1-ba5a-a593c8047fc5"
,"sequenceNumber": 0 ,"state":
"active" ,"participantName":
"John Doe" } ] ,"status": {
{ "chat": { "pollWaitSuggestion":
2000 , “cfgVer”: 1,"events": [ {
"type": "text" ,"participantID":
"00000000-0000-0000-0000-000000000000"
,"sequenceNumber": 1
,"conversationSequenceNumber":
0 ,"contentType": "text\/plain"
,"value": "Welcome to IC!"
,"displayName": "IC" } , {
"type": "text" ,"participantID":
"00000000-0000-0000-0000-000000000000"
,"sequenceNumber": 2
,"conversationSequenceNumber":
0 ,"contentType": "text\/plain"
,"value": "Interaction transferred to Marketing." ,"displayName":
"IC" } , { "type": "text"
,"participantID": "00000000-0000-0000-0000-000000000000"
,"sequenceNumber": 3
,"conversationSequenceNumber":
0 ,"contentType": "text\/plain"
,"value": "Interaction alerting Alan Agent." ,"displayName":
"IC" } ] ,"status": { "type":
{ "chat": { "pollWaitSuggestion":
2000 , “cfgVer”: 1,"events": [{
"type":
Interaction Web Tools Developer's Guide 57
Request Response Description
,"sequenceNumber": 4 ,"state":
"active" ,"participantName":
"Alan Agent" } , { "type": "text"
,"participantID": "00000000-0000-0000-0000-000000000000"
,"sequenceNumber": 5
,"conversationSequenceNumber":
0 ,"contentType": "text\/plain"
,"value": "IC has joined the conversation." ,"displayName":
"IC" } ] ,"status": { "type":
"success" } } } GET /websvcs/chat/poll/94e8c3b0
HTTP/1.0 { "chat": { "pollWaitSuggestion":
2000 , “cfgVer”: 1,"events": [ ] ,"status": { "type": "success" } } }
HTTP/1.0 { "chat": { "pollWaitSuggestion":
2000 , “cfgVer”: 1,"events": [ {
"type": "typingIndicator"
,"participantID": "3da146e0-0344-47a7-b9f5-d88fafe98108"
,"sequenceNumber": 6 ,"value":
true } ] ,"status": { "type":
HTTP/1.0 { "chat": { "pollWaitSuggestion":
2000 , “cfgVer”: 1,"events": [ {
"type": "typingIndicator"
,"participantID": "3da146e0-0344-47a7-b9f5-d88fafe98108"
,"sequenceNumber": 7 ,"value":
false } , { "type": "text" and indicates that agent
Interaction Web Tools Developer's Guide 58
Request Response Description
0344-47a7-b9f5-d88fafe98108"
,"sequenceNumber": 8
,"conversationSequenceNumber":
0 ,"contentType": "text\/plain"
,"value": "Hello, how may I help you?" ,"displayName": "Alan Agent" } ] ,"status": { "type":
{ "typingIndicator": true}
{ "chat": { "pollWaitSuggestion":
2000 , “cfgVer”: 1, "events": [ ] ,"status": { "type": "success" } } }
{"message": "Can you please tell me my account balance? My account number is 12345.\n", "contentType":
"text/plain"}
{ "chat": { "pollWaitSuggestion":
2000 , “cfgVer”: 1, "status": {
"type": "success" } ,"events": [ ] } }
{ "chat": { "pollWaitSuggestion":
2000 , “cfgVer”: 1, "events": [ {
"type": "text" ,"participantID":
"94e8c3b0-aeee-40e1-ba5a-a593c8047fc5"
,"sequenceNumber": 9
,"conversationSequenceNumber":
0 ,"contentType": "text\/plain"
,"value": "Can you please tell me my account balance? My account number is 12345."
,"displayName": "John Doe" } ] ,"status": { "type": "success" } } }
{ "typingIndicator": false}
{ "chat": { "pollWaitSuggestion":
2000 , “cfgVer”: 1, "events": [ ] ,"status": { "type": "success" } } }
Interaction Web Tools Developer's Guide 59
Request Response Description
GET /websvcs/chat/poll/94e8c3b0-aeee-40e1-ba5a-a593c8047fc5 HTTP/1.0
{ "chat": { "pollWaitSuggestion":
2000 , “cfgVer”: 1, "events": [ {
"type": "typingIndicator"
,"participantID": "3da146e0-0344-47a7-b9f5-d88fafe98108"
,"sequenceNumber": 10 ,"value": true } ] ,"status": {
{ "chat": { "pollWaitSuggestion":
2000 , “cfgVer”: 1, "events": [ {
"type": "typingIndicator"
,"participantID": "3da146e0-0344-47a7-b9f5-d88fafe98108"
,"sequenceNumber": 11 ,"value": false } , { "type":
"text" ,"participantID":
"3da146e0-0344-47a7-b9f5-d88fafe98108"
,"sequenceNumber": 12
,"conversationSequenceNumber":
0 ,"contentType": "text\/plain"
,"value": "Your balance is
$678.90. Is there anything else I can help you with?"
,"displayName": "Alan Agent" } ] ,"status": { "type": "success"
} } } and indicates that agent
{ "typingIndicator": true}
{ "chat": { "pollWaitSuggestion":
2000 , “cfgVer”: 1, "events": [ ] ,"status": { "type": "success" } } }
{"message": "No thank you. Good bye!\n", "contentType": "text/plain"}
{ "chat": { "pollWaitSuggestion":
2000 , “cfgVer”: 1, "status": {
"type": "success" } ,"events": [ ] } }
{ "chat": { "pollWaitSuggestion":
2000 , “cfgVer”: 1, "events": [ {
"type": "text" ,"participantID":
"94e8c3b0-aeee-40e1-ba5a-a593c8047fc5"
,"sequenceNumber": 13
Client polls.
Interaction Web Tools Developer's Guide 60
Request Response Description
,"conversationSequenceNumber":
0 ,"contentType": "text\/plain"
,"value": "No thank you. Good bye!" ,"displayName": "John Doe" } ] ,"status": { "type":
{ "typingIndicator": false}
{ "chat": { "pollWaitSuggestion":
2000 , “cfgVer”: 1, "events": [ ] ,"status": { "type": "success" } } }
{ "chat": { "pollWaitSuggestion":
2000 , “cfgVer”: 1, "events": [ {
"type": "typingIndicator"
,"participantID": "3da146e0-0344-47a7-b9f5-d88fafe98108"
,"sequenceNumber": 14 ,"value": true } ] ,"status": {
{ "chat": { "pollWaitSuggestion":
2000 , “cfgVer”: 1, "events": [ {
"type": "typingIndicator"
,"participantID": "3da146e0-0344-47a7-b9f5-d88fafe98108"
,"sequenceNumber": 15 ,"value": false } , { "type":
"text" ,"participantID":
"3da146e0-0344-47a7-b9f5-d88fafe98108"
,"sequenceNumber": 16
,"conversationSequenceNumber":
0 ,"contentType": "text\/plain"
,"value": "Have a nice day!"
,"displayName": "Alan Agent" } ] ,"status": { "type": "success"
} } } and indicates that agent
{ "chat": { "pollWaitSuggestion":
2000 , “cfgVer”: 1, "status": {
"type": "success" } ,"events": [ ] } }
Client exits the chat.
Interaction Web Tools Developer's Guide 61
Appendix B: How to Set and Use JavaScript Tracing
If you have a problem with the Interaction Web Tools API or client, you can turn up the tracing level to make the problem easier to diagnose. You can then use Firebug or another web debugging tool to view the trace log information.
To set trace levels and view trace logging:
1. Display the Web browser's Developer Console.
2. In a chat window, the agent or customer types one of the following instructions:
set tracelevel all set tracelevel verbose set tracelevel note set tracelevel status set tracelevel warning set tracelevel error set tracelevel critical
3. View the trace logging in the Developer Console.
Interaction Web Tools Developer's Guide 62
Change Log
Change Log Date Changed…
2011-10-21 Initial release version.
2012-01-10 Added section on adding fields to the chat registration form. Made a few other minor tweaks. Updated
copyrights and other standard text.
2012-01-25 Added section on adding custom information to
chat/callback. Corrected capitalization of Bootloader.js in several locations.
2013-07-30 Corrected a code line in the "Reconnect" section.
Updated code in Appendices A and B. Did other general cleanup.
2013-08-05 Updated code for JSON, discussed routing contexts, and made other miscellaneous updates.
2013-08-22 Added 2,000-character subject field limit info to "Create a Callback."
2013-10-09 In Chapter 4, added a new section with HTTP header information.
2013-12-02 Added Chapter 5, "Sending and Receiving Web Pages Using Handlers." The chapter had been in the Web Services Technical Reference. I modified it for inclusion in the current document.
2014-03-18 Updated "Embedding Within Another Web Page," "Chats And Callbacks to Multiple Queues," "Creating a Post-Chat Page," and "Adding Custom Information to a Chat" for some JavaScript code changes.
2014-05-21 Added information about transcript features.
2014-06-12 Added Chapter 7 about Interaction Mobilizer.
2014-08-08 Updated documentation to reflect changes required in the transition from version 4.0 SU# to CIC 2015 R1, such as updates to product version numbers, system requirements, installation procedures, references to Interactive Intelligence Product Information site URLs, and copyright and trademark information.
2014-01-25 Added information about developing responsive UIs for mobile devices and other enhancements.
2015-10-05 Updated cover page and copyright information.