Developers
Install the messenger
Your own keys in every sample. Sign in and the code on this page uses your web agent's publishable key.
Sign in
Add this to every page the messenger should be on, before the closing </body> tag. It
opens with the bar, side panel or corner button you chose for the agent in the dashboard.
<script src="https://api.bindkit.ai/widget.js"></script>
<script>
BindKit.messenger({
publishableKey: 'pk_...',
// Who is signed in, as your team sees under People. Leave it out for anonymous visitors.
user: { id: '42', email: 'sam@example.com', name: 'Sam', plan: 'Growth' },
// Signed on your server, so the agent can act as them (see Identify signed-in users).
userToken: () => fetch('/bindkit-token').then((res) => res.text()),
suggestions: ['How do I invite my team?'],
})
</script>
With nobody to identify and nothing to set, the key alone does it:
<script src="https://api.bindkit.ai/widget.js" data-publishable-key="pk_..." async></script>
React
<BindKit /> is the same messenger as the script tag, with the same options as props.
Render it once, anywhere: it draws itself over your app. When the signed-in user changes, it forgets the
last one's conversations.
import { BindKit } from '@bindkit/react'
export function App({ user }) {
return (
<>
<Routes />
<BindKit
publishableKey="pk_..."
user={user && { id: user.id, email: user.email, name: user.name }}
userToken={() => fetch('/bindkit-token').then((res) => res.text())}
/>
</>
)
}
BindKit.open(), close(), toggle(), ask() and
on() work from any component.
import { BindKit } from '@bindkit/react'
export function InvoiceRow({ invoice }) {
return (
<button onClick={() => BindKit.ask(`Why did invoice ${invoice.number} fail?`)}>
Ask about this
</button>
)
}
Options
| Option | What it does |
|---|---|
publishableKey |
The web agent's key, used by the messenger and the knowledge base on your page. It is safe in a page: it gives no access to your dashboard. Your MCP servers still check what each user may do. |
user |
Who is signed in: id, email, name, tags and
any attributes, such as plan. Leave it out for anonymous visitors.
|
userToken |
The same, signed by your server. A token, or a function that fetches a fresh one. |
layout |
BindKit.MessengerLayout.BAR, PANEL or BUBBLE. The agent's
setting unless set. Each name stands for its plain string, so 'panel' works too.
|
launcher |
false leaves out the bar or button, for a page that opens it itself. |
closable |
false keeps it open once it is: no close button, and Escape and the shortcut don't
close it. BindKit.close() from your page still does.
|
element |
An element of the page, or a CSS selector, to draw the messenger inside instead of over the page,
as on a help page. It fills the element, at least 480px tall, and stays open; layout,
launcher, closable and shortcut don't apply.
|
shortcut |
The keys that open and close it, such as 'mod+k', or false for none. The
Appearance setting unless set.
|
language |
The language the messenger is in, such as 'de', 'pt' or
'zh-TW', and the one the agent answers in until the visitor writes in another. Pass
your app's language when you know it. Unless set, the language chosen in the dashboard, which can
be the visitor's browser's. Arabic, Hebrew and Persian are written right to left.
|
greeting |
What a new conversation opens with, instead of “Ask” and the agent's name. |
suggestions |
Questions a new conversation offers to start from. |
css |
CSS added after the messenger's own. Your page's CSS does not reach the messenger, which sits in a
shadow root, but this does. Its parts have bk- classes, such as
.bk-panel, .bk-bar and .bk-launcher.
|
test |
true on your development or staging site: the messenger looks and opens as it will in
production, but only says back what is typed. No conversation or person is made, and nothing
counts against your plan. With the script tag alone, add data-test.
|