Messaging API

The purpose of the MessagingAPI API call is to request an engagement (messaging session) with an agent, who is logged into the Nuance messaging system. Upon making a successfull request to the Nuance Messaging System, the onSuccessListener.onResponse method is invoked with an EngageStatusResponse object as its parameter .

* Note: You should not directly instantiate the MessagingAPI class. Instead use the following Messaging builder class:

  1. MessagingBuilder
  2. MessagingAPI Methods
  3. EngageStatusResponse
  4. Code Example
Public Methods

You can use the following builder public methods to pass the parameters needed to setup an engagement. MessagingBuilder exposes its public method in such a way that you cannot invoke Builder.build until you call all of the required fields.

Also, you must invoke Builder.build to create an engagement object. The engagement object must be type-casted to the MessagingAPI to access its public methods.

Public Methods
Public Methods
  • public String getStatus()

    getStatus method returns one of following values which denotes status of the engagement request.


    Constant.QUEUED

    Constant.DENIED

    Constant.ACCEPTED

Public Methods
  • public int getStatusCode()

    getStatusCode method returns one of the following values.


    401: Chat can not be created

    403: The user does not have sufficient privileges to use the API or to access the requested site.

    500: Server error



	 String siteID = "your site id";
	 String businessUnitID = "your business Unit id";
	 String agentGroupID = "your agent group id";
	 String businessRuleID = "your business rule id";
	 String initialMessage = "Initial customer message. eg: editText.getText();";
	 String openerMesage = "Opener message displayed in messaging window."

	 Engagement.EngagementBuilder engagementBuilder = MessagingAPI.builder()
	.siteID(siteID).businessUnitID(businessUnitID).agentGroupID(agentGroupID)
	.businessRuleID(businessRuleID).initialMessage(initialMessage).openerMessage(openerMesage);

    engagementBuilder.setSuccessListener(new OnSuccessListener<EngageStatusResponse>() {
                    @Override
                    public void onResponse(EngageStatusResponse response) {
                        switch (response.getStatus()){
                            case Constant.DENIED:
                                break;
                            case Constant.QUEUED:
                            case Constant.ACCEPTED:
                                break;

                        }
                    }
                });

    engagementBuilder.setErrorListener(new OnErrorListener() {
                    @Override
                    public void onErrorResponse(Response response) {
                       if(response.getStatusCode() == 401){
					   }
                    }
                });

    MessagingAPI engageMessaging = (MessagingAPI)engagementBuilder.build();
	engageMessaging.startNewEngagement();