---
schema_version: "1"
id: 2377c99749948386966b10d93d938ddcec3f2a2c14a8c71fcf5363ea38126a7f
title: onTypingUpdate()
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/service-cloud/api-console/guides/api-console/classic-api/methods/chat/sforce-api-console-ontypingupdate.md
canonical_url: https://developer.salesforce.com/docs/service/api-console/guide/sforce-api-console-ontypingupdate.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 1b333a99960d1a7c52c0660e790cca4f413cf1773e5d8c1c47b5f53623bcc467
products:
  - Salesforce Console Developer Guide
  - Service Cloud Developer Content
---

# onTypingUpdate()

Registers a function to call when the customer’s text in the chat window changes. If Sneak Peek is enabled, this function is called whenever the customer edits the text in the chat window. If Sneak Peek is not enabled, this function is called whenever a customer starts or stops typing in the chat window. Available in API version 29.0 or later.

## Syntax

```javascript
sforce.console.chat.onTypingUpdate(chatKey:String, callback:Function)
```

## Arguments

|Name|Type|Description|
|----|----|-----------|
|`chatKey`|String|The `chatKey` associated with the chat for which to call a function when a customer begins typing a new message to the agent.|
|`callback`|function|JavaScript method called upon completion of the method.|

## Sample Code–Visualforce

<!-- otherprops: set_clipboard -->
```apex_page
<apex:page >
    <apex:includeScript value="/support/console/68.0/integration.js"/>
    <script type="text/javascript">
        var eventHandler = function (result) {
            alert('There is a new typing update in this chat');
        }
        //Get the value for 'myChatKey'from the sforce.console.chat.getDetailsByPrimaryTabId() or other chat methods. 
        //These values are for example purposes only
        var chatKey = 'myChatKey';
        sforce.console.chat.onTypingUpdate(chatKey, eventHandler);
    </script>
</apex:page>


```

## Response

This method is asynchronous so it returns its response in an object in a callback method. The response object contains the following properties:

|Name|Type|Description|
|----|----|-----------|
|`isTyping`|Boolean|Indicates whether a chat visitor is typing (`true`) or not (`false`).|
|`sneakPeek`|String|The text the chat visitor is currently typing into their input box in the chat window. This is visible only if Sneak Peek is enabled for the agent.|
|`success`|Boolean|`true` if firing event was successful; `false` if firing event wasn’t successful.|

