WABridges
INSTALL PROVISION PAIR SEND RECEIVE
Full API Docs

NODE.JS QUICKSTART

Send your first WhatsApp message in under 5 minutes. You need a WA Bridges API key - get one from the dashboard.

1. INSTALL

SHELL
npm install axios express
ENV
export WA_API_KEY="sk_..."

2. PROVISION A BRIDGE

One bridge = one WhatsApp number. customer_ref is your internal identifier (user ID, slug, etc.).

JAVASCRIPT
const axios = require('axios')

const API_KEY = process.env.WA_API_KEY
const BASE    = 'https://wabridges.com/api'

async function provision(customerRef, webhookUrl) {
  const { data } = await axios.post(`${BASE}/instances`, {
    customer_ref: customerRef,
    webhook_url:  webhookUrl,
  }, {
    headers: { Authorization: `Bearer ${API_KEY}` }
  })
  return data // { id, customer_ref, state }
}

const bridge = await provision('user-123', 'https://yourbackend.com/hook')
console.log(bridge)
RESPONSE
{"id": 42, "customer_ref": "user-123", "state": "running"}

3. PAIR A PHONE

Request a pairing code. Open WhatsApp on the phone, go to Linked Devices → Link a device → Link with phone number, then enter the code.

JAVASCRIPT
async function pair(customerRef, phone) {
  const { data } = await axios.post(
    `${BASE}/instances/${customerRef}/proxy/pair`,
    { phone },
    { headers: { Authorization: `Bearer ${API_KEY}` } }
  )
  return data.code // "ABCD-EFGH"
}

const code = await pair('user-123', '15550001234')
console.log(`Enter this code on the phone: ${code}`)
RESPONSE
{"code": "ABCD-EFGH"}

Once paired, the bridge fires a connected webhook event. Poll /proxy/status or wait for the event.

4. SEND A MESSAGE

JAVASCRIPT
async function sendText(customerRef, to, body) {
  const { data } = await axios.post(
    `${BASE}/instances/${customerRef}/proxy/send/text`,
    { chat: to, body },
    { headers: { Authorization: `Bearer ${API_KEY}` } }
  )
  return data // { message_id, timestamp }
}

await sendText('user-123', '15559876543', 'Hello from the API!')
RESPONSE
{"message_id": "ACE41E...", "timestamp": 1777180605}

5. RECEIVE EVENTS

Inbound messages and events are delivered via POST to your webhook_url. Return 200 immediately.

JAVASCRIPT
const express = require('express')
const app = express()
app.use(express.json())

app.post('/hook', (req, res) => {
  res.sendStatus(200)

  const { event, ...data } = req.body
  if (event === 'message' && !data.from_me) {
    console.log(`${data.name}: ${data.body}`)
    // reply with sendText(data.chat_id, 'Got it!')
  }
})

app.listen(3000)

See the webhook guide for all event types and fields.