Quick start
Send your first WhatsApp message through the API. You need a workspace with a connected number.
1. Make an API key
In the dashboard, API keys, make a key. It is shown once, so save it somewhere safe.
- Test keys (
ss_test_…) run every check but never reach Meta. Sends answer with a made-up message ID and"test": true. Nothing is delivered or charged. - Live keys (
ss_live_…) send for real.
2. Check the key
Send the key in the X-API-Key header. GET /v1/me answers with your workspace and the key's mode.
curl https://api.sociallysnap.app/v1/me -H "X-API-Key: ss_test_YOUR_KEY"3. Find your number
GET /v1/phone_numbers lists the workspace's numbers. A number can send when can_send is true. With several numbers, pass one of them as from when you send.
curl https://api.sociallysnap.app/v1/phone_numbers -H "X-API-Key: ss_test_YOUR_KEY"4. Open the 24-hour window
WhatsApp only allows free-form messages within 24 hours of the customer's last message. For this test, send any message from your own phone to your business number first. Outside the window, only an approved template can be sent.
5. Send a text
The body is Meta's Cloud API message body. Put your own phone number in to, with the country code and no plus sign.
curl https://api.sociallysnap.app/v1/messages \
-H "X-API-Key: ss_test_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"messaging_product":"whatsapp","to":"YOUR_NUMBER","type":"text","text":{"body":"Hello"}}'$body = @{
messaging_product = "whatsapp"
to = "YOUR_NUMBER"
type = "text"
text = @{ body = "Hello" }
} | ConvertTo-Json
Invoke-RestMethod -Method Post -Uri "https://api.sociallysnap.app/v1/messages" `
-Headers @{ "X-API-Key" = "ss_test_YOUR_KEY" } `
-ContentType "application/json" -Body $bodyconst response = await fetch("https://api.sociallysnap.app/v1/messages", {
method: "POST",
headers: { "X-API-Key": process.env.SOCIALLYSNAP_API_KEY, "Content-Type": "application/json" },
body: JSON.stringify({ messaging_product: "whatsapp", to: "YOUR_NUMBER", type: "text", text: { body: "Hello" } }),
});
console.log(response.status, await response.json());Node: HTTP Request
Method: POST
URL: https://api.sociallysnap.app/v1/messages
Authentication: Generic Credential Type > Header Auth
Name: X-API-Key
Value: your key
Send Body: JSON
{"messaging_product":"whatsapp","to":"YOUR_NUMBER","type":"text","text":{"body":"Hello"}}A successful answer looks like this:
{
"messaging_product": "whatsapp",
"contacts": [{ "input": "923000000000", "wa_id": "923000000000" }],
"messages": [{ "id": "wamid.EXAMPLE_ONLY" }]
}6. See it in Logs
The dashboard's Logs page shows every message from the last 30 days with its status: Sent, Delivered, Read or Failed, with the reason in plain words. Message text is never stored.
When something goes wrong
Errors come back with an HTTP status and a message that says what to do:
{
"error": {
"code": "number_unavailable",
"message": "This number isn't working right now. Reconnect it in the dashboard, then try again."
}
}When Meta refuses a message, error.meta carries Meta's own code and message. The API reference lists every code.
PowerShell 5.1
Invoke-RestMethod in Windows PowerShell 5.1 hides the error body. Read it like this, or use curl.exe:
$headers = @{ "X-API-Key" = "ss_test_YOUR_KEY" }
try {
Invoke-RestMethod -Method Post -Uri "https://api.sociallysnap.app/v1/messages" -Headers $headers -ContentType "application/json" -Body $body
} catch {
$reader = New-Object System.IO.StreamReader($_.Exception.Response.GetResponseStream())
$reader.ReadToEnd()
}When uploading with curl -F, copy files whose names contain commas to a plain name first.