Upload an image, video, or text-only WhatsApp Status directly from your connected session using Baileys REST Mongo API.
This endpoint supports external webhooks and Hybrid Authentication (API Keys + JWT).
๐ Endpoint
POST https://api.walytic.com/api/whatsapp/:sessionId/update-status
Uploads a new WhatsApp status update (text, image, or video) for the connected WhatsApp session.
๐ Required Headers
Header |
Type |
Required |
Description |
|---|---|---|---|
|
|
โ Yes |
Your API key (for external API integrations). |
|
|
Optional |
JWT Bearer token (for logged-in dashboard users). |
|
|
โ Yes |
Must be |
๐ค Request Body Parameters
Field |
Type |
Required |
Description |
|---|---|---|---|
|
|
โ Optional |
Publicly accessible URL of the media (image or video). Required for media statuses. |
|
|
โ Optional |
Optional caption text for the status. If |
backgroundColor |
string |
#101010 |
|
font |
SANS_SERIF |
{
"fileUrl": "https://res.cloudinary.com/demo/image/upload/sample.jpg",
"caption": "My weekend vibes ๐ด",
"backgroundColor": "#101010",
"font": "SANS_SERIF"
}
โ๏ธ Supported Media Types
Media Type |
Description |
|---|---|
|
JPEG, PNG, or WEBP images. |
|
MP4 or MOV video formats. |
Text only |
When only |
๐ง Internal Workflow (For Developers)
Request hits
controllers/whatsappController.js โ updateStatus()Retrieves the active Baileys session via
sessionManager.getSession(sessionId)Downloads the media (if
fileUrlis present) usingaxios.get(fileUrl)Detects MIME type โ validates it as
image/*orvideo/*-
Sends the status via Baileys:
sock.sendMessage("status@broadcast", content) -
Triggers the configured external webhook with metadata:
{ "event": "statusUpdated", "sessionId": "session-919876543210", "mediaType": "image", "fileUrl": "https://example.com/image.jpg", "caption": "Hello everyone ๐", "timestamp": "2025-10-27T06:21:11Z" }
๐งฉ Example Request (Node.js)
const axios = require("axios");
async function uploadWhatsAppStatus() {
try {
const response = await axios.post(
"https://api.walytic.com/api/whatsapp/session-919876543210/update-status",
{
fileUrl: "https://example.com/myvideo.mp4",
caption: "Weekend vibes! ๐"
},
{
headers: {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
}
);
if (response.data.success) {
console.log("โ
Status uploaded successfully!");
console.log(response.data);
} else {
console.log("โ Error:", response.data.error);
}
} catch (error) {
console.error("Request failed:", error.response?.data || error.message);
}
}
uploadWhatsAppStatus();
๐งพ Example Request (cURL)
$curl -X POST https://api.walytic.com/api/whatsapp/session-919876543210/update-status \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"fileUrl": "https://example.com/pic.jpg",
"caption": "Good Morning ๐"
}'
๐ฆ Example Response (โ Success)
{
"success": true,
"message": "WhatsApp status updated successfully",
"data": {
"sessionId": "session-919876543210",
"mediaType": "image",
"caption": "Good Morning ๐",
"timestamp": "2025-10-27T06:21:11Z"
}
}
โ Example Response (Error)
{
"success": false,
"message": "Failed to update status",
"error": "Session not found or not connected"
}
or
{
"success": false,
"message": "Only image or video types allowed for status"
}
๐ก Webhook Event Examples
โ Status Updated Event
{
"event": "statusUpdated",
"sessionId": "session-919876543210",
"mediaType": "image",
"fileUrl": "https://example.com/pic.jpg",
"caption": "Good Morning ๐",
"timestamp": "2025-10-27T06:21:11Z"
}
๐ Text-only Status Event
{
"event": "statusUpdated",
"sessionId": "session-919876543210",
"mediaType": "text",
"caption": "Just checking in ๐",
"timestamp": "2025-10-27T06:25:11Z"
}
๐ Authentication Flow
Source |
Auth Method |
Header |
|---|---|---|
External Clients |
API Key |
|
Internal Dashboard |
JWT |
|
Middleware hybridAuth validates either method before routing to the controller.
โ๏ธ Notes
Works only if the WhatsApp session is connected (
/api/whatsapp/:sessionId/statuscan be used to check).Supports text, image, or video status updates.
Triggers webhook updates automatically when status is uploaded.
Uses Baileys WebSocket for WhatsApp Web protocol handling.
Media must be accessible via public HTTPS URLs.
Upload limits depend on WhatsApp (max ~30 seconds for video).