Verify on your server
Libraries for Node, Python, PHP and Go, or plain HTTP.
Every library does the same thing: post the token and secret to siteverify, then check the hostname, action and score you expect. None of them throws for a rejected token or a network failure; check success and read the error codes.
Node, Bun, Deno and Workers
import { verify } from "@botbar/server";
const result = await verify(token, {
secret: process.env.BOTBAR_SECRET!,
expectedHostname: ["example.com", "www.example.com"],
expectedAction: "login",
minScore: 0.5,
});Python
from botbar_verify import verify # pip install botbar-verify
result = verify(token, secret=SECRET, expected_hostname="example.com", expected_action="login")averify is the asyncio version.
PHP
$result = (new Botbar\Verifier(getenv('BOTBAR_SECRET')))
->verify($_POST['botbar-response'] ?? '', ['expected_hostname' => 'example.com']);Go
result, err := botbar.Verify(ctx, r.FormValue(botbar.ResponseField), botbar.Options{
Secret: os.Getenv("BOTBAR_SECRET"),
ExpectedHostname: []string{"example.com"},
})Anything else
POST /v1/siteverify with JSON or a form body. See the API reference.
Retries: pass an idempotency_key and a repeated request returns success again instead of timeout-or-duplicate.