BWEZE Docs

Quickstart

Phone-verified OTP over BWEZE SMS in under 10 minutes.

Ship phone verification for Rwandan mobiles with one dependency and no build step, using the OTP template.

1. Get a key and balance

In the dashboard: create a workspace, create an API token from the Send SMS template (bw_sk_..., shown once), and top up the wallet under Billing. Sends are prepaid - 15 RWF per SMS segment. A zero-balance workspace gets 402 insufficient_balance on its first send.

2. Run the template

cp .env.example .env          # put your bw_sk_... key in
npm install                   # pulls @bweze/messaging from npm
node --env-file=.env server.mjs

3. Send and verify

curl -X POST localhost:8787/otp/send -H content-type:application/json \
  -d '{"phone":"0788123456"}'
# → SMS: "Your MyApp code is 481953. It expires in 5 minutes."

curl -X POST localhost:8787/otp/verify -H content-type:application/json \
  -d '{"phone":"0788123456","code":"481953"}'
# → {"ok":true}

Codes are hashed at rest, single-use, expire in 5 minutes, burn after 5 wrong attempts, and resends are cooled down 60 seconds. node --test test.mjs asserts all of it - including a live send when BWEZE_API_KEY is set.

Or call the API directly

import { BwezeMessaging } from "@bweze/messaging";

const sms = new BwezeMessaging({ apiKey: process.env.BWEZE_API_KEY! });
await sms.send({
  to: "+250788123456",
  template: "Your code is {{code}}",
  data: { code: 4821 },
  idempotencyKey: "signup-4821",
});

On this page