Skip to content

Native apps

The quickest way into a native app is the hosted app page: the full chat, full screen, made for a WebView. Your app opens it, your server gives it a token, and a small bridge tells the app when to close the screen or open its login.

The assistant in an app for a guest The assistant in an app for a signed-in customer

In Settings → Channels, add app. App conversations then show up separately in Conversations and Analytics.

An app has no website address, so it cannot start a guest chat by itself. Your server signs a visitor token for every app user. Because of that you can turn Settings → Guest sessions off: minted tokens keep working, and nobody can open an anonymous chat with your publishable key.

User vid ext ch
Signed in customer-<id> your customer id app
Guest app-<random id saved on the device> none app

Return the token with the chat URL:

{
"token": "eyJ…",
"expiresAt": "2026-10-10T12:00:00Z",
"url": "https://api.example.com/widget/app.html?key=pk_…&locale=tr&channel=app"
}

Protect the endpoint like your other app calls, and use the visitor secret only on the server.

Load url#token=<token>. The token goes in the fragment so it never reaches a server log.

Query parameter Meaning
key Your publishable key (required)
locale The chat’s language, e.g. tr
channel Default app
title Overrides the header title

Tokens last at most 24 hours. Fetch a new one before it expires, and when the user signs in or out, and pass it to the open page:

window.Helpvane.setToken('<new token>');

The page sends JSON strings { "type": …, "payload": … }:

type When What the app does
ready The chat loaded Optional: hide a spinner
close The user pressed ✕ Close the chat screen
signin The user pressed “Sign in” Open the app’s login; afterwards send a signed-in token
action A card button was pressed (payload.product.url for products) Open the product in the app
status The conversation was handed over, solved or closed Optional

iOS (WKWebView): add a script message handler named helpvane:

config.userContentController.add(handler, name: "helpvane")
// handler.userContentController(_:didReceive:) → message.body is the JSON string

Android (WebView): add a JavaScript interface named HelpvaneBridge:

webView.settings.javaScriptEnabled = true
webView.settings.domStorageEnabled = true
webView.addJavascriptInterface(object {
@JavascriptInterface fun postMessage(json: String) { /* … */ }
}, "HelpvaneBridge")

React Native’s ReactNativeWebView.postMessage is supported too.

Answers can contain links to your pages. Let the WebView load only the chat’s own host, and open every other link in your app (or the browser).

  • A guest sees the chat with the sign-in bar; “Sign in” opens the app’s login.
  • After logging in, the chat says “Signed in as …” and answers “where is my order?”.
  • ✕ closes the screen; the chat history is still there when it is opened again.
  • The conversation appears in Conversations with channel app.