NPM is the recommended installation method. It pairs nicely with module bundlers such as Webpack.
If you don't have access to NPM, you can download the latest version via a CDN.
<script src="https://unpkg.com/@botpoison/browser" async></script>
import Botpoison from "@botpoison/browser";const botpoison = new Botpoison({publicKey: "pk_xxxxxxxx"});
import Botpoison from "@botpoison/browser";const botpoison = new Botpoison({publicKey: "pk_xxxxxxxx"});const { solution } = await botpoison.challenge();
import Botpoison from "@botpoison/browser";const botpoison = new Botpoison({publicKey: "pk_xxxxxxxx"});const { solution } = await botpoison.challenge({onProgress: (progress) => {if(progress === 0.5) {console.log("Halfway there");}else if(progress === 1) {console.log("Finished");}}});
This is particularly useful for SSR frameworks such as Next.js and Nuxt.js (where window may be undefined on the initial load).
import Botpoison from "@botpoison/browser";Botpoison.init()