Skip to content

Opening the chat from your own button

Calling the JavaScript API from anything on your page, and why you never have to wait for the loader.

You do not have to use the launcher in the corner. Any element on your page can open the chat.

<button type="button" onclick="Talkfront('open')">Chat to us</button>

The commands

Call What it does
Talkfront('open') Opens the chat window
Talkfront('close') Closes it
Talkfront('identify', { … }) Says who the visitor is
Talkfront('set', { … }) Adds your own details to them
Talkfront('reset') Forgets them, for sign-out

identify, set and reset are covered in identify, set and reset.

Calling it before the loader has arrived

The snippet is async, so for the first moment of a page load window.Talkfront does not exist yet and calling it throws. If you need to call it early (passing a signed-in user, say), add this stub above the snippet:

<script>
  window.Talkfront = window.Talkfront || function () {
    (window.Talkfront.q = window.Talkfront.q || []).push(arguments);
  };
</script>
<script src="https://widget.talkfront.app/loader.js" data-site="pk_live_your_site_key" async></script>

It collects calls in a queue, and the loader replays them in order the moment it arrives. With it in place this is safe at the top of the page:

Talkfront('identify', { id: 'usr_1042', name: 'Marcus Webb' });

There is still no ready event to listen for and no reason to poll for window.Talkfront. If you have written a setTimeout to wait for it, the stub replaces it.

Without the stub, call Talkfront from a click handler or anywhere else that runs after the page has settled, and it will be there.

Your button and ours both work

There is no setting that hides the launcher, so adding your own button gives people two ways in rather than replacing the one in the corner. Both open the same conversation.

Do not open it on page load

Talkfront('open') opens the chat window, which means it also builds the iframe. Called on arrival, that gives up the thing that makes the widget cheap: it normally loads nothing but a button until somebody wants to talk.

Open it in response to a click. If you want to start the conversation yourself, a proactive message is the tool for that. The rules are checked in the visitor’s browser and it costs nothing until one fires.

Last updated 22 September 2026.