API Documentation
Welcome to the G4 Message Developer API. Build powerful WhatsApp engagement applications using our enterprise-grade infrastructure.
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.
/api/auth/login
Authenticate a user and receive a Sanctum bearer token.
Request Body (JSON)
Response
/api/auth/register
Create a new user account and receive a bearer token.
/api/auth/forgot-password
Send a password reset email.
/api/auth/logout
Revoke the current bearer token. Requires authentication.
/api/auth/user
Return the currently authenticated user's profile, plan, and credit balance.
Accounts
/api/whatsapp/accounts
List all WhatsApp accounts connected to the authenticated user.
Conversations
/api/whatsapp/conversations
Paginated list of conversations. Optional query params: account_id, status (open/resolved), search.
/api/whatsapp/conversations/{id}/messages
Retrieve paginated message history for a specific conversation.
/api/whatsapp/send
Send a message to a contact. Supports text, template, and media messages.
/api/whatsapp/conversations/{id}/flag
Toggle the flagged (urgent) status of a conversation.
/api/whatsapp/conversations/{id}/resolve
Mark a conversation as resolved. It will reopen automatically if the contact replies.
Contacts
/api/whatsapp/contacts
List contacts for an account. Supports filtering by tag, search query, and pagination.
/api/whatsapp/contacts
Create a new contact.
/api/whatsapp/contacts/{id}
Update a contact's name, tags, or custom fields.
/api/whatsapp/contacts/{id}
Permanently delete a contact and their conversation history.
Broadcasts
/api/whatsapp/broadcasts
List all broadcast campaigns with their delivery stats.
/api/whatsapp/broadcasts
Create and optionally schedule a new broadcast campaign.
Templates
/api/whatsapp/templates
List all WhatsApp message templates for an account, including their approval status.
/api/whatsapp/templates
Create and submit a new template to Meta for approval.
/api/whatsapp/templates/sync
Sync templates from the Meta Business Account to update their approval status locally.
Chatbots
/api/whatsapp/chatbots
List all rule-based chatbots for an account.
/api/whatsapp/chatbots
Create a new chatbot with trigger keywords and flow steps.
/api/whatsapp/chatbots/{id}
Update a chatbot's configuration, triggers, or flow steps.
/api/whatsapp/chatbots/{id}
Permanently delete a chatbot.
AI Bots
/api/whatsapp/aibots
List all AI bots for an account.
/api/whatsapp/aibots
Create a new AI bot with a system prompt and knowledge documents.
/api/whatsapp/aibots/{id}
Update an AI bot's configuration or toggle its active status.
/api/whatsapp/aibots/{id}
Permanently delete an AI bot and its training data.
Quick Replies
/api/whatsapp/quick-replies
List all saved quick reply snippets for an account.
Analytics
/api/whatsapp/analytics/summary
Retrieve aggregated analytics for an account over a date range. Query params: account_id, from, to.
Teams
/api/whatsapp/teams
List all team members for the authenticated user's WhatsApp accounts.
Funnels
/api/whatsapp/funnels
List all drip automation funnels for an account.
Device
/api/device/register
Register a mobile device token for push notifications (FCM).
Notifications
/api/notifications
List all notifications for the authenticated user, paginated.
/api/notifications/unread-count
Return the count of unread notifications for the authenticated user.
/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.
Missing or invalid bearer token.
Insufficient credits. Top up required.
You do not have permission to access this resource.
Validation error. Check the
errors field for details.
Rate limit exceeded. Retry after the
Retry-After header value.
Unexpected server error. Contact support with the request ID.