# Live Chat Widget Callback Function

This documentation provides a flexible set of methods that can be used in your web projects. To invoke one of the methods below, please be sure to call a method after the embed code on your page.

Use this callback functions to manipulate the chat widget displayed on your website.

### OnCreateCase

This callback functions triggered every time the user create a new case

```jsx
<script>
tapliveCallback.tapliveOnCreateCase = (caseModel, fullname, email, url) => {
    // your action here
}
</script>
```

{% hint style="info" %}

#### Returned Parameters

`CaseModel`: (caseModel) data related to case.\
`fullname`: (String) full name of the user.\
`email`: (String) email of the user.\
`url`: (String) the page url when user access the live chat widget.
{% endhint %}

### OnSendMessage

This callback functions triggered every time the user send a message

```jsx
<script>
tapliveCallback.tapliveOnSendMessage = (message, fullname, email, url) => {
    // your action here
}
</script>
```

{% hint style="info" %}

#### Returned Parameters

`message`: (messageModel) data related to message.\
`fullname`: (String) full name of the user.\
`email`: (String) email of the user.\
`url`: (String) the page url when user access the live chat widget.
{% endhint %}

This documentation provides a flexible set of methods that can be used in your web projects. To invoke one of the methods below, please be sure to call a method after the embed code on your page.

Use this callback functions to manipulate the chat widget displayed on your website.

### TapliveIsAuthenticated

This function returns boolean if session is available or not

```jsx
<script>
TapTalkLive.tapliveIsAuthenticated();
</script>
```

### SetForceHide

This function is use to hide the launcher widget

```jsx
<script>
TapTalkLive.setForceHide();
</script>
```

### TapliveRequestAccessToken

This function is use to request taplive access token

```jsx
<script>
TapTalkLive.tapliveRequestAccessToken(key, () => {
    //do action here
});
</script>
```

### SetHideTaplivePower

This functions is use to hide taplive watermark

```jsx
<script>
TapTalkLive.setHideTaplivePower();
</script>
```

### LauncherLogout

This functions is use to logging out launcher widget

```jsx
<script>
TapTalkLive.launcherLogout(() => {
    //do action here
});
</script>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.taptalk.io/onetalk-omnichannel-documentation/live-chat-widget-callback-function.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
