Getting started with JavaScript
1. Install and import the @botpoison/browser library.
npm install @botpoison/browser
2. Create a new Botpoison instance with your public key.
3. Process a challenge using the challenge() function.
4. Forward the solution to your server for verification.
javascript
import axios from "axios";// 1. Import the libraryimport Botpoison from "@botpoison/browser";// 2. Create a new instance with your public keyconst botpoison = new Botpoison({publicKey: 'pk_xxxxxxxx'});const sendMessage = async (message) => {// 3. Process a challengeconst { solution } = await botpoison.challenge();await axios.post("https://example.demo", {message,// 4. Forward the solution_botpoison: solution,});}