API Documentation

Welcome to the G4 Message Developer API. Build powerful WhatsApp engagement applications using our enterprise-grade infrastructure.

Base URL: https://testbrand.wa.g4.business/api

All endpoints require a Bearer token in the Authorization header unless otherwise noted. Tokens are obtained via the Authentication endpoints.

Authentication

Authenticate by posting credentials to /api/auth/login. Store the returned token and include it as a Bearer token on all subsequent requests.

// Header format
Authorization: Bearer YOUR_ACCESS_TOKEN
POST /api/auth/login

Authenticate a user and receive a Sanctum bearer token.

Request Body (JSON)
{ "email": "user@example.com", "password": "secret" }
Response
{ "token": "1|abc123...", "user": { "id": 1, "name": "Jane", "email": "user@example.com" } }
POST /api/auth/register

Create a new user account and receive a bearer token.

{ "name": "Jane Doe", "email": "jane@example.com", "password": "secret", "password_confirmation": "secret" }
POST /api/auth/forgot-password

Send a password reset email.

{ "email": "user@example.com" }
DELETE /api/auth/logout

Revoke the current bearer token. Requires authentication.

GET /api/auth/user

Return the currently authenticated user's profile, plan, and credit balance.

Accounts

GET /api/whatsapp/accounts

List all WhatsApp accounts connected to the authenticated user.

[{ "id": 1, "phone_number": "+1234567890", "display_name": "Acme Support", "status": "active" }]

Conversations

GET /api/whatsapp/conversations

Paginated list of conversations. Optional query params: account_id, status (open/resolved), search.

{ "data": [{ "id": 42, "contact": { "name": "John Smith", "phone": "+1..." }, "last_message": "Hello", "status": "open", "unread_count": 2 }], "meta": { "current_page": 1, "total": 100 } }
GET /api/whatsapp/conversations/{id}/messages

Retrieve paginated message history for a specific conversation.

POST /api/whatsapp/send

Send a message to a contact. Supports text, template, and media messages.

{ "account_id": 1, "to": "+1234567890", "type": "text", "message": "Hello from the API!" }
POST /api/whatsapp/conversations/{id}/flag

Toggle the flagged (urgent) status of a conversation.

POST /api/whatsapp/conversations/{id}/resolve

Mark a conversation as resolved. It will reopen automatically if the contact replies.

Contacts

GET /api/whatsapp/contacts

List contacts for an account. Supports filtering by tag, search query, and pagination.

POST /api/whatsapp/contacts

Create a new contact.

{ "account_id": 1, "name": "Jane Doe", "phone": "+1234567890", "tags": ["lead", "vip"] }
PUT /api/whatsapp/contacts/{id}

Update a contact's name, tags, or custom fields.

DELETE /api/whatsapp/contacts/{id}

Permanently delete a contact and their conversation history.

Broadcasts

GET /api/whatsapp/broadcasts

List all broadcast campaigns with their delivery stats.

POST /api/whatsapp/broadcasts

Create and optionally schedule a new broadcast campaign.

{ "account_id": 1, "template_id": 5, "contact_ids": [101, 102, 103], "variables": { "1": "John", "2": "Order #456" }, "scheduled_at": "2026-04-10T09:00:00Z" }

Templates

GET /api/whatsapp/templates

List all WhatsApp message templates for an account, including their approval status.

POST /api/whatsapp/templates

Create and submit a new template to Meta for approval.

{ "account_id": 1, "name": "order_confirmation", "category": "TRANSACTIONAL", "language": "en_US", "components": [{ "type": "BODY", "text": "Hi 1, your order 2 is confirmed!" }] }
POST /api/whatsapp/templates/sync

Sync templates from the Meta Business Account to update their approval status locally.

Chatbots

GET /api/whatsapp/chatbots

List all rule-based chatbots for an account.

POST /api/whatsapp/chatbots

Create a new chatbot with trigger keywords and flow steps.

PUT /api/whatsapp/chatbots/{id}

Update a chatbot's configuration, triggers, or flow steps.

DELETE /api/whatsapp/chatbots/{id}

Permanently delete a chatbot.

AI Bots

GET /api/whatsapp/aibots

List all AI bots for an account.

POST /api/whatsapp/aibots

Create a new AI bot with a system prompt and knowledge documents.

{ "account_id": 1, "name": "Support Bot", "system_prompt": "You are a helpful support agent for Acme Corp.", "is_active": true }
PUT /api/whatsapp/aibots/{id}

Update an AI bot's configuration or toggle its active status.

DELETE /api/whatsapp/aibots/{id}

Permanently delete an AI bot and its training data.

Quick Replies

GET /api/whatsapp/quick-replies

List all saved quick reply snippets for an account.

Analytics

GET /api/whatsapp/analytics/summary

Retrieve aggregated analytics for an account over a date range. Query params: account_id, from, to.

{ "total_messages_sent": 1540, "total_delivered": 1498, "total_read": 1120, "broadcast_campaigns": 8, "active_conversations": 34 }

Teams

GET /api/whatsapp/teams

List all team members for the authenticated user's WhatsApp accounts.

Funnels

GET /api/whatsapp/funnels

List all drip automation funnels for an account.

Device

POST /api/device/register

Register a mobile device token for push notifications (FCM).

{ "device_token": "fcm_token_here", "platform": "android" }

Notifications

GET /api/notifications

List all notifications for the authenticated user, paginated.

GET /api/notifications/unread-count

Return the count of unread notifications for the authenticated user.

POST /api/notifications/{id}/read

Mark a specific notification as read.

Error Handling

We use standard HTTP status codes. All error responses include a JSON body with a message field.

401 Unauthorized
Missing or invalid bearer token.
402 Payment Required
Insufficient credits. Top up required.
403 Forbidden
You do not have permission to access this resource.
422 Unprocessable Entity
Validation error. Check the errors field for details.
429 Too Many Requests
Rate limit exceeded. Retry after the Retry-After header value.
500 Server Error
Unexpected server error. Contact support with the request ID.
Support Center
My Tickets
...
...
Commands: /new fresh chat · /compact shrink thread
New Ticket