WABridges
INSTALL PROVISION PAIR SEND RECEIVE
Full API Docs

GO QUICKSTART

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

1. INSTALL

Go has no required dependencies. The examples use the standard library net/http and encoding/json.

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.).

GO
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
    "os"
)

const base = "https://wabridges.com/api"

func waPost(path string, body any) map[string]any {
    apiKey := os.Getenv("WA_API_KEY")
    b, _   := json.Marshal(body)
    req, _ := http.NewRequest("POST", base+path, bytes.NewReader(b))
    req.Header.Set("Authorization", "Bearer "+apiKey)
    req.Header.Set("Content-Type", "application/json")
    resp, _ := http.DefaultClient.Do(req)
    defer resp.Body.Close()
    var result map[string]any
    json.NewDecoder(resp.Body).Decode(&result)
    return result
}

func main() {
    bridge := waPost("/instances", map[string]string{
        "customer_ref": "user-123",
        "webhook_url":  "https://yourbackend.com/hook",
    })
    fmt.Println(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.

GO
result := waPost("/instances/user-123/proxy/pair", map[string]string{
    "phone": "15550001234",
})
fmt.Println("Enter this code on the phone:", result["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

GO
msg := waPost("/instances/user-123/proxy/send/text", map[string]string{
    "chat": "15559876543",
    "body": "Hello from the API!",
})
fmt.Println(msg["message_id"])
RESPONSE
{"message_id": "ACE41E...", "timestamp": 1777180605}

5. RECEIVE EVENTS

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

GO
package main

import (
    "encoding/json"
    "fmt"
    "net/http"
)

func hookHandler(w http.ResponseWriter, r *http.Request) {
    var payload map[string]any
    json.NewDecoder(r.Body).Decode(&payload)
    w.WriteHeader(http.StatusOK)

    if payload["event"] == "message" && payload["from_me"] != true {
        fmt.Printf("%s: %s\n", payload["name"], payload["body"])
    }
}

func main() {
    http.HandleFunc("/hook", hookHandler)
    http.ListenAndServe(":3000", nil)
}

See the webhook guide for all event types and fields.