HTTP API
Send WhatsApp messages from WhatSync
Use the Send API from construction operations tools, automations, backend jobs, and support workflows. v1 supports direct text, image, and document messages from the connected WhatsApp account.
Authentication
Send a bearer token with every request. For the construction app, use the token shown in the dashboard MCP setup card. The token is scoped to the connected WhatSync workspace and sends from that workspace's WhatsApp account.
Authorization: Bearer YOUR_CONSTRUCTION_TOKENEndpoint
POST https://construction.whasupcrm.com/api/v1/messages/sendSend Text
Text sends require a recipient phone number and non-empty text. Use international phone number format when possible.
curl -X POST "https://construction.whasupcrm.com/api/v1/messages/send" \
-H "Authorization: Bearer YOUR_CONSTRUCTION_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"to": "+917999709798",
"type": "text",
"text": "The site inspection is scheduled for 4 PM."
}'Send Image
Image URLs must be public HTTPS URLs. Localhost, private network addresses, and non-HTTPS URLs are rejected.
curl -X POST "https://construction.whasupcrm.com/api/v1/messages/send" \
-H "Authorization: Bearer YOUR_CONSTRUCTION_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"to": "+917999709798",
"type": "image",
"image": {
"url": "https://example.com/site-progress.jpg",
"caption": "Latest slab progress photo."
}
}'Send Document
Documents use public HTTPS URLs. Provide a file name and MIME type when your system knows them.
curl -X POST "https://construction.whasupcrm.com/api/v1/messages/send" \
-H "Authorization: Bearer YOUR_CONSTRUCTION_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"to": "+917999709798",
"type": "document",
"document": {
"url": "https://example.com/daily-report.pdf",
"fileName": "daily-report.pdf",
"mimetype": "application/pdf",
"caption": "Daily site report attached."
}
}'Node Example
const response = await fetch("https://construction.whasupcrm.com/api/v1/messages/send", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_CONSTRUCTION_TOKEN",
"Content-Type": "application/json",
},
body: JSON.stringify({
to: "+917999709798",
type: "text",
text: "Concrete pour starts at 7 AM tomorrow.",
}),
});
const result = await response.json();Responses
{
"accepted": true,
"messageId": "BAE5...",
"remoteJid": "[email protected]",
"to": "+917999709798",
"normalizedPhone": "917999709798",
"status": "accepted"
}The construction Send API uses the existing WhatsApp send path and returns after WhatsApp accepts the message. It does not expose the CRM queue or send-attempt status endpoints.
Error Codes
| Code | Meaning |
|---|---|
| missing_bearer_token | The Authorization header is missing or malformed. |
| invalid_bearer_token | The bearer token is invalid. |
| invalid_request | Request JSON is missing required fields. |
| invalid_phone_number | Phone number must contain 7 to 15 digits. |
| not_connected | The connected WhatsApp account is offline. |
| recipient_not_found | The phone number is not reachable on WhatsApp. |
| invalid_media_url | Media URL is not a safe public HTTPS URL. |