WACM.in Logo
Back to API Docs

WhatsApp Business API

Wpbox API Reference

Integrate with WhatsApp Cloud API to send messages, manage contacts, run campaigns, and automate customer communication at scale.

Overview

The Wpbox API provides programmatic access to WhatsApp Business features. Built on top of the Meta WhatsApp Cloud API (v19.0), it enables you to send messages, manage contacts, create campaigns, and work with approved message templates.

Base URL

https://api.wacm.in/api/v1

All endpoints require authentication via Bearer token or query parameter. The API supports both GET and POST methods for most endpoints for maximum compatibility.

Authentication

Use your Personal Access Token from the WACM dashboard (Settings → API) to authenticate requests.

Example Request
curl -X GET "https://api.wacm.in/api/v1/contacts" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Accept: application/json"

Webhook Setup

Configure your WhatsApp webhook URL in the Meta Developer Console to receive incoming messages and status updates.

Webhook URL
https://yourdomain.com/api/wpbox/{your_sanctum_token}

The webhook accepts both GET (verification) and POST (message delivery) requests. Use a Laravel Sanctum personal access token for verification.

Webhook Payload - Incoming Message

Text Message Payload
{
  "entry": [{
    "id": "WABA_ID",
    "changes": [{
      "value": {
        "messaging_product": "whatsapp",
        "messages": [{
          "from": "919876543210",
          "id": "wamid.XXX",
          "timestamp": "1234567890",
          "type": "text",
          "text": { "body": "Hello" }
        }],
        "contacts": [{
          "profile": { "name": "John Doe" },
          "wa_id": "919876543210"
        }]
      }
    }]
  }]
}

Webhook Payload - Status Update

Status Update Payload
{
  "entry": [{
    "changes": [{
      "value": {
        "messaging_product": "whatsapp",
        "statuses": [{
          "id": "wamid.XXX",
          "status": "delivered",
          "timestamp": "1234567890",
          "recipient_id": "919876543210"
        }]
      }
    }]
  }]
}

Profile

GET
/me

Get authenticated user profile

Response
{
  "id": 1,
  "name": "John Doe",
  "email": "john@example.com",
  "company_id": 1,
  "role": "owner"
}

Contacts

GET
/contacts

List all contacts with pagination

POST
/contacts

Create a new contact

GET
/contacts/{id}

Get contact details with groups and fields

PUT
/contacts/{id}

Update contact information

GET
/contacts/{id}/groups-and-fields

Get contact groups and custom fields

GET
/contacts/{id}/notes

Get contact notes

POST
/contacts/check-phone

Check if phone number exists on WhatsApp

Create Contact

Request
curl -X POST "https://api.wacm.in/api/v1/contacts" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "John Doe",
    "phone": "+919876543210",
    "email": "john@example.com"
  }'

Request Body

ParameterTypeRequiredDescription
namestringRequiredContact full name
phonestringRequiredWhatsApp phone number with country code
emailstringOptionalContact email address
country_idintegerOptionalCountry ID reference
user_idintegerOptionalAssigned agent/user ID

Response

201 Created
{
  "id": 123,
  "name": "John Doe",
  "phone": "+919876543210",
  "email": "john@example.com",
  "avatar": null,
  "enabled_ai_bot": true,
  "subscribed": true,
  "created_at": "2025-01-15T10:30:00.000000Z"
}

Messages

POST
/messages/text

Send a text message

GET
/messages/text

Send a text message (GET)

POST
/messages/template

Send an approved template message

GET
/messages/template

Send template message (GET)

POST
/messages/list

Send an interactive list message

GET
/messages/list

Send list message (GET)

Send Text Message

Request
curl -X POST "https://api.wacm.in/api/v1/messages/text" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "+919876543210",
    "message": "Hello! This is a test message from WACM API."
  }'

Request Body

ParameterTypeRequiredDescription
phonestringRequiredRecipient WhatsApp number
messagestringRequiredMessage text content

Send Template Message

Request
curl -X POST "https://api.wacm.in/api/v1/messages/template" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "+919876543210",
    "template_name": "order_confirmation",
    "language": "en",
    "variables": {
      "1": "John Doe",
      "2": "ORD-12345"
    }
  }'

Send List Message

Request
curl -X POST "https://api.wacm.in/api/v1/messages/list" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "+919876543210",
    "header": "Choose an option",
    "body": "Please select from the options below:",
    "footer": "Powered by WACM",
    "button_text": "View Options",
    "sections": [
      {
        "title": "Main Menu",
        "rows": [
          { "id": "opt1", "title": "Check Order Status" },
          { "id": "opt2", "title": "Talk to Support" }
        ]
      }
    ]
  }'

Templates

GET
/templates

List all approved templates

GET
/templates/{id}

Get template details

Response

200 OK
{
  "data": [
    {
      "id": 1,
      "name": "order_confirmation",
      "status": "APPROVED",
      "category": "UTILITY",
      "language": "en",
      "components": [...],
      "created_at": "2025-01-15T10:30:00.000000Z"
    }
  ]
}

Groups

GET
/groups

List all contact groups

Response
{
  "data": [
    {
      "id": 1,
      "name": "VIP Customers",
      "contact_count": 150,
      "created_at": "2025-01-15T10:30:00.000000Z"
    }
  ]
}

Campaigns

GET
/campaigns

List all campaigns

POST
/campaigns/send

Create and send a campaign

Send Campaign

Request
curl -X POST "https://api.wacm.in/api/v1/campaigns/send" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Summer Sale 2025",
    "template_id": 1,
    "group_id": null,
    "contact_id": null,
    "variables": {
      "1": "Summer Sale",
      "2": "50% OFF"
    }
  }'

Request Body

ParameterTypeRequiredDescription
namestringRequiredCampaign name
template_idintegerRequiredWhatsApp template ID
group_idintegerOptionalTarget group ID (null = all contacts)
contact_idintegerOptionalSpecific contact ID (override)
variablesobjectOptionalTemplate variable values
is_botbooleanOptionalEnable as bot reply
triggerstringOptionalComma-separated trigger keywords

Conversations

GET
/conversations

List all conversations

GET
/conversations/{id}/messages

Get conversation messages

Get Conversation Messages

Response
{
  "data": [
    {
      "id": 1,
      "contact_id": 123,
      "value": "Hello! How can I help you?",
      "is_message_by_contact": 0,
      "message_type": 1,
      "status": 4,
      "created_at": "2025-01-15T10:30:00.000000Z"
    },
    {
      "id": 2,
      "contact_id": 123,
      "value": "I need help with my order",
      "is_message_by_contact": 1,
      "message_type": 1,
      "status": 4,
      "created_at": "2025-01-15T10:31:00.000000Z"
    }
  ]
}

Message Types Reference

TypeCodeDescription
TEXT1Plain text message
MEDIA2Image, video, document, or audio
LOCATION3Location share (Google Maps)
NFM_REPLY5Interactive flow reply

Message Status Codes

0Scheduled - Message queued for sending
1Sending - Message being sent to WhatsApp
2Sent - WhatsApp accepted the message
3Delivered - Message delivered to device
4Read - Message read by recipient
5Failed - Message failed to send

Error Responses

400Bad Request - Invalid parameters or payload
401Unauthorized - Invalid or missing API token
403Forbidden - Insufficient permissions or plan limits
404Not Found - Resource does not exist
429Too Many Requests - Rate limit exceeded
500Internal Server Error - Something went wrong

Error Response Format

Error Response
{
  "message": "The phone number is required.",
  "errors": {
    "phone": ["The phone field is required."]
  }
}

eCommerce Store API

Manage products, categories, and orders.

View Docs