Messages
Send a text message
POST
/messages/textScope messages:sendSends a free-form text reply. Only works while the person's 24-hour window is open, meaning they messaged you in the last 24 hours. Otherwise send a template.
Body
tostringrequiredRecipient phone number with country code, for example
+919876543210. Spaces and dashes are ignored. A number without a country code is not guessed at and will not reach anyone.fromstringWhich of your WhatsApp numbers to send from. Accepts the number itself, its Meta
phone_number_idor its Wamafy id. Defaults to your default number.textstringrequiredThe message. Up to 4,096 characters.
Errors
| Status | Code | When |
|---|---|---|
| 400 | NO_OPEN_CONVERSATION | The window is closed or the person never messaged you. Send a template instead. |
Plus the errors any endpoint can return, such as a missing key or scope. See Errors.
Request
# macOS, Linux or Git Bash, with WAMAFY_API_KEY set. The quoting does not work in Windows cmd or PowerShell.
curl -X POST "https://api.wamafy.com/api/v1/public/messages/text" \
-H "Authorization: Bearer $WAMAFY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "+919876543210",
"text": "Yes, the blue one is in stock. Shall I keep it aside for you?"
}'Response 200
{
"success": true,
"data": {
"messageId": "wamid.HBgMOTE5ODc2NTQzMjEwFQIAERgSRjI",
"conversationId": "2b7e4f10-8c3a-4d2e-b1f6-0a9c5e7d3b21",
"status": "sent"
}
}Base URL https://api.wamafy.com/api/v1/public