WhatsBridge API Documentation

Everything you need to integrate WhatsApp messaging

Welcome to WhatsBridge API

WhatsBridge provides a powerful interface for managing and interacting with WhatsApp through an easy-to-use web interface and API. It allows businesses and developers to integrate WhatsApp messaging capabilities into their systems with enterprise-grade reliability.

🚀 Key Features

  • Session Management
  • QR Code Authentication
  • RESTful API Integration
  • Webhook Support
  • Real-time Messaging

📖 API Information

Base URL: https://wabsync.com/api/v1
Version: v1
Authentication: Bearer Token
Content-Type: application/json

🚀 Quick Start Guide

1

Get API Token

Obtain your API token from the dashboard to authenticate your requests.

2

Create Session

Create a WhatsApp session and authenticate using QR code.

3

Send Messages

Start sending messages through your authenticated session.

Authentication

Secure your API requests with Bearer tokens

WhatsBridge API uses Bearer token authentication. You need to include your API token in the Authorization header of your requests.

Getting Your API Token

To get your API token:

  1. Log in to your WhatsBridge dashboard
  2. Navigate to API Tokens
  3. Generate or copy your new API token

Authorization Header

Authorization: Bearer YOUR_API_TOKEN

⚠️ Security Note

Keep your API token secure and never expose it in client-side code. Rotate your tokens regularly for enhanced security.

Create Session

Create a new WhatsApp session for your account

POST /api/v1/session/create

This endpoint creates a new WhatsApp session that can be used for sending and receiving messages.

Request Parameters

Parameter Type Required Description
session_name string Required Name for the session (max 100 characters)

Code Examples

curl -X POST "https://wabsync.com/api/v1/session/create" \
    -H "Authorization: Bearer YOUR_API_TOKEN" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{
        "session_name": "My WhatsApp Session"
    }'
                                    

Response Example

{
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "name": "My WhatsApp Session",
    "status": "created",
    "qr_code_url": null,
    "ai_agents": []
}

Get All Sessions

Retrieve all WhatsApp sessions for your account

GET /api/v1/session/all

This endpoint returns a list of all WhatsApp sessions associated with your account, including their current status and configuration.

Code Examples

curl -X GET "https://wabsync.com/api/v1/session/all" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json"

Response Example

{
    "data": [
        {
        "id": "123e4567-e89b-12d3-a456-426614174000",
        "name": "My WhatsApp Session",
        "status": "ready",
        "qr_code_url": null,
        "ai_agents": [
            {
            "id": "ai-agent-uuid",
            "name": "Customer Support Bot",
            "is_active": true,
            "is_default": true
            }
        ]
        }
    ]
}

Get Session Info

GET /api/v1/session/{sessionId}

Retrieve information about a specific WhatsApp session.

Path Parameters

Parameter Type Description
sessionId string The UUID of the session
curl -X GET "https://wabsync.com/api/v1/session/123e4567-e89b-12d3-a456-426614174000" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json"

Response Example

{
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "name": "My WhatsApp Session",
    "status": "ready",
    "qr_code_url": null,
    "ai_agents": [
        {
        "id": "ai-agent-uuid",
        "name": "Customer Support Bot",
        "is_active": true,
        "is_default": true
        }
    ]
}

Get QR Code

GET /api/v1/session/{sessionId}/get-qr-code

Get the QR code for WhatsApp authentication.

Path Parameters

Parameter Type Description
sessionId string The UUID of the session
curl -X GET "https://wabsync.com/api/v1/session/123e4567-e89b-12d3-a456-426614174000/get-qr-code" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json"

Response Example

{
    "success": true,
    "qr_code_url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
    "message": "QR code generated successfully"
}

Request Auth Code

POST /api/v1/session/{sessionId}/request-auth-code

Request an authentication code via SMS instead of QR code.

Path Parameters

Parameter Type Description
sessionId string The UUID of the session

Request Parameters

Parameter Type Required Description
phone string Yes Phone number with country code
curl -X POST "https://wabsync.com/api/v1/session/123e4567-e89b-12d3-a456-426614174000/request-auth-code" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
    "phone": "212670039289"
}'

Response Example

{
    "success": true,
    "message": "Authentication code requested. Please check your SMS."
}

Send Message

POST /api/v1/session/{sessionId}/send-message

Send a message through a specific WhatsApp session.

Path Parameters

Parameter Type Description
sessionId string The UUID of the session

Request Parameters

Parameter Type Required Description
phone string Required Phone number without country code
type string Required Message type (text, file, location)
content string|object Required Message content based on type

Message Types

Text Message

{
    "phone": "1234567890",
    "type": "text",
    "content": "Hello World! \\nThis is a new line."
}

File Message

{
    "phone": "1234567890",
    "type": "file",
    "content": {
        "file": {
        "mimetype": "application/pdf",
        "filename": "document.pdf",
        "url": "https://example.com/path/to/file.pdf"
        }
    }
}

Location Message

{
    "phone": "1234567890",
    "type": "location",
    "content": {
        "title": "Location Name",
        "latitude": 38.8937255,
        "longitude": -77.0969763
    }
}
curl -X POST "https://wabsync.com/api/v1/session/123e4567-e89b-12d3-a456-426614174000/send-message" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
    "phone": "1234567890",
    "type": "text",
    "content": "Hello World!"
}'

Response Example

{
    "success": true,
    "message": "Message sent successfully",
    "data": {
        "messageId": "false_1234567890@c.us_3A30BDECACB201A59D44"
    }
}

Send Chat State

POST /api/v1/session/{sessionId}/send-chat-state

Send chat state indicators like typing or recording.

Path Parameters

Parameter Type Description
sessionId string The UUID of the session

Request Parameters

Parameter Type Required Description
phone string Yes Recipient phone number with country code
state string Yes Chat state: typing, recording, or stop
curl -X POST "https://wabsync.com/api/v1/session/123e4567-e89b-12d3-a456-426614174000/send-chat-state" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json" \
-d "phone=1234567890&state=typing"

Response Example

{
    "success": true,
    "message": "Chat state sent successfully"
}

Mark Message as Seen

POST /api/v1/session/{sessionId}/send-seen

Mark a message as seen (read receipt).

Path Parameters

Parameter Type Description
sessionId string The UUID of the session

Request Parameters

Parameter Type Required Description
phone string Yes Sender phone number with country code
messageId string Yes ID of the message to mark as seen
curl -X POST "https://wabsync.com/api/v1/session/123e4567-e89b-12d3-a456-426614174000/send-seen" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json" \
-d "phone=1234567890&messageId=false_1234567890@c.us_3A30BDECACB201A59D44"

Response Example

{
    "success": true,
    "message": "Message marked as seen"
}

Webhooks

Real-time event notifications for your applications

Webhooks allow you to receive real-time notifications about events in your WhatsApp sessions. Configure webhook URLs in your dashboard to receive POST requests when events occur, enabling instant responses to user interactions.

How Webhooks Work

1

Event occurs in your WhatsApp session

2

WabSync sends POST request to your endpoint

3

Your application processes the event

Webhook Events

session.status_changed

Triggered when a session status changes (e.g., from "created" to "ready")

{
    "event": "session.status_changed",
    "session_id": "123e4567-e89b-12d3-a456",
    "old_status": "created",
    "new_status": "ready",
    "timestamp": "2024-01-01T12:00:00Z"
}

message.received

Triggered when a new message is received

{
    "event": "message.received",
    "session_id": "123e4567-e89b-12d3-a456",
    "message": {
        "id": "false_1234567890@c.us_3A30BD",
        "from": "1234567890",
        "type": "text",
        "content": "Hello!",
        "timestamp": "2024-01-01T12:00:00Z"
    }
}

🔒 Webhook Security

Webhooks include a signature header for verification. Always validate webhook signatures to ensure requests come from WabSync.

X-WabSync-Signature: sha256=hash

Best practices for webhook security:

  • • Verify signature on every request
  • • Use HTTPS for webhook URLs
  • • Implement proper error handling
  • • Return 200 status on success