telybot A little less ordinary.
A lot more intelligent.
United Kingdom Sign in Talk to us Start free
Telybot docsReference

Widget API

How the Telybot chat widget behaves on your page, and the JavaScript API for developers or anyone who wants the chat to open from their own button.

Installing

<script src="https://telybot.com/widget.js"
        data-key="tb_live_your_key_here" async></script>

The script tag needs only src and data-key. One more is optional: data-job, in the tag copied from a job on Hiring, opens the chat on that job's application. Everything else — colours, position, greeting, language — comes from your dashboard so you never have to redeploy your site to change them.

Step-by-step instructions, including how to check it works, are in Install on any website.

The widget is drawn in the language set on Train → Messages & fallback → Language your bot speaks: its button, placeholders and notices, and the direction of the layout (Arabic and Urdu are right-to-left). There is nothing to translate on your side.

Modes

Floating (default). A launcher button in a bottom corner or on a side edge, opening a chat panel.

Inline. Put an empty container on the page and the chat fills it instead:

<div data-telybot-bot style="height:520px"></div>

The container needs a height. In inline mode the chat is always visible, so there is nothing to open or close, and it shows even while your bot is in draft, with a "not available" message.

JavaScript API

Available on window.TelyBot once the script has loaded:

CallWhat it does
TelyBot.open()Opens the chat panel
TelyBot.close()Closes it
TelyBot.toggle()Opens or closes
TelyBot.expand()Makes the panel as tall as the window and up to 760px wide
TelyBot.shrink()Back to the standard card
TelyBot.isOpentrue when the chat is visible
TelyBot.isExpandedtrue while the panel is expanded
TelyBot.clientIdThe client id this page is using
TelyBot.prefill(text)Puts a question in the message box, unsent, for the visitor to send
TelyBot.setVisitor({ name, phone, email })Your signed-in customer's details, offered in the chat's forms; TelyBot.setVisitor(null) forgets them
TelyBot.identify(token)Tells the chat who is signed in, with a token your server signed (Verified visitors); TelyBot.identify('') on sign-out

Example — open the chat from your own "Chat with us" button:

<button onclick="TelyBot.open()">Chat with us</button>
window.TelyBot exists as soon as the script has run, but open() does nothing until the chat has loaded its settings, and nothing while your bot is in draft. Call it from a click rather than as the page loads. A token known when the page is made can go in window.TelyBotSettings = { userToken: token } before the script tag instead; the chat reads it as it starts.

How it behaves on your page

  • The panel opens above the launcher button, which stays where it is and becomes the close control. Tapping it again, the ✕ in the header, or pressing Escape closes the chat.
  • A visitor can expand the panel from the header — it grows to the height of the window and up to 760px wide — and the choice is remembered in their browser. On phones the panel is already the whole screen, so the control is not shown there.
  • Your logo size setting changes the logo, not the button: the launcher keeps its size and the logo grows inside it. Button size (Install → Appearance) is what resizes the button itself — small, medium or large — whatever shape it is.
  • Five button shapes, under Install → Appearance: a pill with your label, a circle, a rounded square, a speech bubble with a tail, and a drop. The tail sits on the side facing your page.
  • Everything renders inside a shadow root, so your CSS cannot break the widget and the widget's CSS cannot touch your site.
  • The panel loads only when a visitor opens it, so it does not slow your page down.
  • The chat opens on your welcome and up to four suggested questions as buttons — write your own under Train → Messages & fallback → Suggested questions, or leave them to the defaults. Nothing else is said until the visitor taps one or types, and your catalog's cards appear when they ask about prices or items, not before.
  • With Say it is an AI assistant on (in Train → Messages & fallback), the header says “AI assistant” under your bot's name on every screen.
  • A chat lasts as long as the visitor's browser tab. Moving between your pages keeps it, and reopening the panel restores the thread — files included, and a welcome-flow question that was still waiting for an answer. Closing the tab ends it, and their next visit opens a fresh chat. A reply from your team still reaches a visitor who asked for a person, in their next chat, for two weeks.
  • Chats from the same browser are linked in Chats (“Visitor · 3 chats”), so you can read one visitor's conversations side by side. The link is a random id kept in the visitor's browser; it is not created when their browser asks not to be tracked.
  • The paperclip in the composer lets a visitor attach up to three photos or documents to a message (sizes and types in Limits and security). Photos are downscaled in the browser before upload, so a 12-megapixel snapshot leaves the page at a few hundred kilobytes. Switch off Let visitors send photos and files in Train → Messages & fallback and the button goes.
  • A welcome flow runs as ordinary bubbles: choices become buttons under the bubble, a Skip button appears when a step is optional, and the composer's placeholder becomes the question. A completed flow is remembered in the visitor's browser for 30 days.
  • If the assistant cannot be reached, the widget shows a short message and never throws an error into your page.

Inside the app SDKs

The same chat runs in every SDK, so attachments and welcome flows reach your app with no release. Opening a file picker from a web view is the host's job, and every Telybot SDK does it.

On iOS the system sheet offers Take Photo whenever images are accepted, and choosing it crashes an app that has no NSCameraUsageDescription in its Info.plist. Add the key before you ship a build with the chat in it.
Next: App SDKs →