Messaging API
The Messaging API API requests an engagement (also known as a messaging session) with an agent who has logged into Nuance Messaging System. Upon making a successful request to Nuance Messaging Systems, completionBlock is invoked with success and error response objects as parameters .
You should not directly instantiate MessagingAPI class. Instead use init method with a block parameter, which returns an instance of MessagingAPI class.
EngageBuilder
Builder instance is passed as an argument to the above init block. Use the builder instance to setup the parameter need to start an engagement.
Public Properties
You can use the following builder public properties to pass the parameters need to setup an engagement.
Finally invoke MessagingAPI instance startNewEngagement method to create an engagement with an Agent.
-
NSString *siteID
Set the SiteID which is required to instantiate MessagingAPI object.
-
NSString *businessUnitID
Set the Business Unit ID to check agent availability and HOP availability.
-
NSString *agentGroupID
Set the agentGroupID which is required for a new engagement.
-
NSString *businessRuleID
Business rule ID is used to tie this engagement to a business rule for reporting purposes.
-
NSString *initialMessage
Initial message sent by customer.
-
NSString *businessRuleName
Business rule name is used as chat title in the AI. Default value is EAPI.
-
long automationID
Associated automation ID with this engagement request.
-
LaunchType launchType
launchType is displayed in the Agent Interface to notify the Agent which type of device or experience that the customer is in. Possible values are MOBILE or TABLET
-
NSString *openerMessage
Opener message that will be added to transcript upon agent assign.
-
long pageID
Page Marker ID where an engagement starts.
-
long prioity
Initial engagement priority of the engagement request. A higher number indicates a higher priority in the queue.
-
long queueMessagingSpecID
The ID of the queue messaging spec as identified in TouchPortal. If the queue messaging spec is valid, it will pull the proper queue message and display it as message text when the API caller calls the Get message API call.
-
long queueThreshold
Queue threshold value for engagement. Used to calculate whether this engagement goes into the queue in cases where agent slots are not available.
-
NSString *scriptID
ID of the agent’s scripts for this engagement.
-
NSDictionary *agentAttributes
List of agent attributes used in routing process. Format: attribute1,value1;attribute2,value2 etc.
MessagingAPI
Public Methods
-
-(void) startNewEngagement: (void (^) (EngageStatusResponse *success, Resposne *error))completionBlock
Start a new messaging engagment with the agent.
EngageStatusResponse
An instance of this class is passed as an argument to the completionBlock. This will be nil if there is an error in the request.
Public Properties
-
NSString *status
status property has one of following values which denotes status of the engagement request.
"queued"
"denied"
"accepted"
Response
Response object is passed as an argument to the completionBlock. This will be nil if there is no error in this request.
Public Properties
-
long statusCode
statusCode property will have one of the following values.
401: Chat can not be created
400: Request has incorrect parameters
403: User hasn't privileges to use api or to see requested site
500: Server error
let siteID = "your site id";
let businessUnitID = "your business Unit id";
let agentGroupID = "your agent group id";
let businessRuleID = "your business rule id";
let initialMessage = "Initial customer message";
let openerMesage = "Opener message displayed in messaging window."
let engagement = MessagingAPI.init(block:{ (builder) in
builder?.siteID = siteID;
builder?.businessUnitID = businessUnitID;
builder?.agentGroupID = agentGroupID;
builder?.businessRuleID = businessRuleID;
builder?.initialMessage = initialMessage;
});
engagement?.startNewEngagement({ (success, error) in
if(error != nil) {
} else {
}
})