Customer Typing API

The the CustomerTypingAPI call is used to let the agent know when the customer starts or stops typing.

The API method for sending the customer typing status is exposed from the NuanMessaging class.

  1. Using the CustomerTyping API
  2. Accessing Response
  3. Code Example
Public Methods

Use the public methods shown here from the NuanMessaging Class to send customer typing status message to the agent.

Public Methods
  • public int getStatusCode()

    getStatusCode method returns following values which denotes the status of this request.


    400: Request has incorrect parameters.

    401: There is no such chat on server, chat should be started anew

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

    500: Server error.



	 editText.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {

                if(isTyping == false && count>0 && NuanMessaging.getInstance().getEngagementID() != null) {

                    isTyping = true;
                    sendTypingStatus(isTyping);
                }

                handler.removeCallbacks(input_finish_checker);
            }

            @Override
            public void afterTextChanged(Editable s) {
                if(textWatcher != null) {
                    textWatcher.afterTextChanged(s);
                }
                if (NuanMessaging.getInstance().getEngagementID() != null) {
                    last_text_edit = System.currentTimeMillis();
                    handler.removeCallbacks(input_finish_checker);
                    handler.postDelayed(input_finish_checker, delay);
                }
            }
        });

	private Runnable input_finish_checker = new Runnable() {
        public void run() {
            if (System.currentTimeMillis() > (last_text_edit + delay - 500)) {
                isTyping = false;
                if(NuanMessaging.getInstance().getEngagementID() != null) {
                    sendTypingStatus(isTyping);
                }
            }
        }
    };

    private void sendTypingStatus(boolean status) {
        NuanMessaging.getInstance().sendCustomerTypingStatus(status);
    }