BotProt Lobby
The lobby is the browser side of BotProt. It is a script you add to your page with a script tag. It talks to the BotProt service, renders each step on your page, and gives you the token once the visitor is verified. You shouldn't call the BotProt service yourself.
What you get
The lobby is a set of files, all served next to each other:
botprot.js, the script. It addscreateBotProtto thewindow.OpenTicketglobal.skins/{name}.js, optional skins. A skin decides where BotProt appears on your page and what the visitor sees around it.botprot.d.tsandskins/{name}.d.ts, type declarations you can save in your project.
botprot.js never replaces an existing window.OpenTicket object, so it works next to other OpenTicket scripts in any order.
How it works
- Load
botprot.js, plus a skin if you use one. - Call
createBotProt(identifier, options)with the shop's GUID as identifier. The options tell BotProt where to render. A skin can supply them for you, and without options BotProt uses a plain element. - BotProt shows its steps in that element until the visitor is done. Steps without visitor input finish by themselves.
- The call resolves with the token. Send it in the
x-botprot-verificationheader on every reservation and order request, see Using the final token. If BotProt cannot finish, it rejects with an error that has acode, such asnetwork,rejectedorlimit, so you can handle each case.
BotProt keeps its progress per identifier in localStorage until the token expires. A visitor who refreshes the
page or comes back from a redirect continues where they left off.
This includes the final token, even after you used it. A new run for the same identifier resolves to the stored
token right away, so a visitor's second order can get the token of their first one. The Shop API refuses that
order with a 403. After a successful order, and on a shared device such as a point of sale, clear it.
With your own retrieveToken and storeToken, forget those keys there instead. See
Refresh and persistence.
Choosing how it looks
There are three ways to show BotProt:
- The reference skin opens a plain dialog over your page. It needs no setup.
- The shop skin shows a landing page in the style of a shop, inside an element you provide. You pass it the shop's GUID and the whitelabel.
- Rolling your own uses no skin. You provide the element and decide what happens on success or failure.
For a shop without steps the visitor solves, you need none of these: call createBotProt with the shop's GUID and no options, see the
smallest integration.
To change the look, style the reference skin with your own CSS or roll your own. Skins compares the three.
Next steps
Read Integration for the code to add BotProt to your page. To try an identifier, a skin and options before you write any code, use the Playground.
To test against a real flow, ask your account manager or customer success contact for a test setup.