Official SDKs
Official bZapper libraries to integrate in minutes, in your language. They all cover the same set of API operations: the 13 message types (text, image, video, document, audio, sticker, location, contact, poll, reaction, buttons, list, and OTP), numbers/instances, API keys, usage, and the advanced features — groups (create, participants, join/leave, invite), presence (typing/recording, including in groups), conversations (inbox, history, archive/pin/read), and contacts.
Tip: explore and test everything in the Playground inside the admin panel, with real sends and ready-made code examples in each language.
The SDKs are publicly available in the official registries — install with a single command, no cloning required. Node, Python, PHP, and Go are live; Java is coming soon.
Installation
| Language | Installation | Import |
|---|---|---|
| Node / TypeScript | npm install @bzapper/client | import { Bzapper } from '@bzapper/client' |
| Python | pip install bzapper | from bzapper import Client |
| PHP | composer require bzapper/bzapper | new Bzapper\Client(...) |
| Go | go get github.com/bernisoftware/bzapper-go | import "github.com/bernisoftware/bzapper-go" |
| Java | Maven br.com.bernisoftware:bzapper (coming soon) | new BzapperClient(...) |
Quick start
Node / TypeScript
import { Bzapper } from '@bzapper/client';
const bz = new Bzapper({ baseUrl: 'https://api.bzapper.com.br', apiKey: 'bz_live_...' });
await bz.sendText({ to: '+5511999999999', body: 'Hello from bZapper! 👋' });
Python
from bzapper import Client
bz = Client("https://api.bzapper.com.br", "bz_live_...")
bz.send_text(to="+5511999999999", body="Hello from bZapper! 👋")
PHP
use Bzapper\Client;
$bz = new Client("https://api.bzapper.com.br", "bz_live_...");
$bz->sendText(["to" => "+5511999999999", "body" => "Hello from bZapper! 👋"]);
Go
bz := bzapper.New("https://api.bzapper.com.br", "bz_live_...")
bz.SendText(context.Background(), bzapper.SendTextParams{
SendBase: bzapper.SendBase{To: "+5511999999999"},
Body: "Hello from bZapper! 👋",
})
Java
var bz = new BzapperClient("https://api.bzapper.com.br", "bz_live_...");
bz.sendText(SendOptions.to("+5511999999999"), "Hello from bZapper! 👋");
Presence in a group
Showing "typing…" in a group is just pointing the presence at the group's JID:
bz.presence_chat(instance_id=inst, to="[email protected]", state="typing")
Webhooks — receiving and processing events
The SDKs receive the webhook payload and process it for you: they verify the
HMAC signature (X-Bzapper-Signature), turn the envelope into a typed event,
and route it to a per-type handler. Each SDK also does the CRUD for webhooks
(createWebhook/listWebhooks/…). Events:
message.{received,sent,delivered,read,failed},
instance.{connected,disconnected,banned,logged_out,warming,status},
group.{joined,participant_added,participant_removed,participant_promoted,participant_demoted,subject_changed,description_changed}.
Python
from bzapper.webhooks import Webhooks
hooks = Webhooks(secret="whsec_...") # secret returned by create_webhook
@hooks.on("message.received")
def _(event):
print(event.sender.name, event.payload["body"])
# in your endpoint — raw body + header. Raises SignatureError if invalid.
hooks.handle(raw_body=request.get_data(), signature=request.headers["X-Bzapper-Signature"])
Node / TypeScript
import { Webhooks } from '@bzapper/client';
const hooks = new Webhooks('whsec_...');
hooks.on('message.received', (e) => console.log(e.sender?.name, e.payload.body));
// Express: use express.raw() and the ready-made middleware
app.post('/webhooks', express.raw({ type: '*/*' }), hooks.middleware());
Go
rx := bzapper.NewWebhookReceiver("whsec_...").
On("message.received", func(e *bzapper.WebhookEvent) { /* ... */ })
http.Handle("/webhooks", rx) // it's an http.Handler: verifies + routes on its own
PHP (new Bzapper\Webhooks($secret)) and Java (new Webhooks(secret)) follow the
same pattern: on(type, handler) + handle(rawBody, signature). Use the
event_id for idempotency (the API may redeliver). Verification is timing-safe;
always pass the raw body (not the re-serialized JSON).
Error handling
Every library throws a typed error with a stable neutral code (always use the
code, never the text) and the HTTP status. Example (Python):
from bzapper import Client, BzapperError
try:
bz.send_text(to="+550000", body="hi")
except BzapperError as e:
print(e.code, e.status_code) # e.g. "instance_not_connected", 409
Each SDK has a full README (in the package's repository) with examples for every message type, groups, presence, conversations, and errors.