WhatsApp API for developers: connect your apps and send messages with one API
Your website, CRM and ERP can talk to WhatsApp through one HTTPS and JSON API. Send templates and free-form messages, run campaigns and receive customer replies.
curl -X POST "https://dashboard.koverage.in/api/v2/whatsapp/message" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "text",
"contacts": [{ "msisdn": "15551234567" }],
"text": { "body": "Hello!" }
}'<?php
$ch = curl_init("https://dashboard.koverage.in/api/v2/whatsapp/message");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOUR_API_KEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"type" => "text",
"contacts" => [["msisdn" => "15551234567"]],
"text" => ["body" => "Hello!"],
]),
]);
echo curl_exec($ch);
curl_close($ch);import requests
url = "https://dashboard.koverage.in/api/v2/whatsapp/message"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
}
body = {
"type": "text",
"contacts": [{"msisdn": "15551234567"}],
"text": {"body": "Hello!"},
}
r = requests.post(url, headers=headers, json=body)
print(r.json())// Node.js 18 or newer
const res = await fetch("https://dashboard.koverage.in/api/v2/whatsapp/message", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
type: "text",
contacts: [{ msisdn: "15551234567" }],
text: { body: "Hello!" },
}),
});
console.log(await res.json());import java.net.URI;
import java.net.http.*;
HttpClient client = HttpClient.newHttpClient();
String json = "{\"type\":\"text\",\"contacts\":[{\"msisdn\":\"15551234567\"}],\"text\":{\"body\":\"Hello!\"}}";
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://dashboard.koverage.in/api/v2/whatsapp/message"))
.header("Authorization", "Bearer YOUR_API_KEY")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> res = client.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(res.body());package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader(`{"type":"text","contacts":[{"msisdn":"15551234567"}],"text":{"body":"Hello!"}}`)
req, _ := http.NewRequest("POST", "https://dashboard.koverage.in/api/v2/whatsapp/message", body)
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(string(out))
}using System.Net.Http;
using System.Text;
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_API_KEY");
var json = "{\"type\":\"text\",\"contacts\":[{\"msisdn\":\"15551234567\"}],\"text\":{\"body\":\"Hello!\"}}";
var res = await client.PostAsync(
"https://dashboard.koverage.in/api/v2/whatsapp/message",
new StringContent(json, Encoding.UTF8, "application/json"));
Console.WriteLine(await res.Content.ReadAsStringAsync());
{
"status": "success",
...
}Accepted means Koverage took your request. Delivery to the phone happens next, on WhatsApp.
Your first WhatsApp message, in five steps
The WhatsApp API for developers needs a key and one request. Here is the whole road, from account to replies.
- 1
Set up your account
Create your Koverage account and connect a WhatsApp number to the API.
Account + WhatsApp number - 2
Copy your API key
Open the API docs in your dashboard. Your key is at the top of the page.
Authorization: Bearer KEY - 3
Send your first request
POST JSON with a type, a contact and a message. Use any language above.
POST /api/v2/whatsapp/message - 4
Check what happened
Your call tells you it was accepted. Look up the delivery report to see delivery.
GET delivery report - 5
Listen for replies
Give Koverage your server address. Each customer reply arrives as a webhook.
event: message_received
Which message can you send? One question decides.
With the WhatsApp API for developers, free-form replies work only while a chat is open. Otherwise you start with a template.
Did this customer message you in the last 24 hours?
GET: check the 24 hour windowSend a free-form message
Reply in your own words. The type can be:
Send a template message
Use a template made for your account. Each recipient can have their own header, body and button values.
Accepted does not mean delivered
In the WhatsApp API for developers, your API response and the delivery on WhatsApp are two different moments. Track both.
Exact status names and error codes are listed in the delivery report and Error Codes pages of your dashboard docs.
How customer replies reach your server
You do not need to keep asking for new messages. The WhatsApp API for developers calls your server when something arrives.
Swipe sideways →
POSTmessage_received
- event_type
- The kind of event, such as text or button_reply
- event
- The details for that event type
- text
- Readable message text. Empty if there is none
- from
- The sender’s number
- msg_id
- The platform’s message id
- timestamp
- An ISO date
event_type values
context.message_id set to the msg_id you received.Everything the WhatsApp API for developers can do
Select a block to see its endpoints. All of them use the same Bearer key.
Tap a block
Messaging
Send one template or free-form message to one or more contacts. Use it for alerts, receipts, OTP-style notices and replies.
- POSTSend one WhatsApp message (template or free-form) to one or more contacts
- POSTMark an inbound message as read
Campaigns
Follow a bulk send from start to end. Change your mind? Cancel what has not gone out yet, or move the date.
- GETList the caller's WhatsApp campaigns
- GETOne campaign in full, with its status funnel
- POSTCancel the unsent remainder of a campaign
- POSTMove a scheduled campaign to a new date and time
Contacts
Keep unwanted senders out of your WhatsApp number, and review who is blocked.
- POSTBlock one or more contacts on a WhatsApp phone
- DELETEUnblock one or more contacts
- GETList blocked contacts for a WhatsApp phone
Delivery reports
Look up one message to see how it went after your API call was accepted. Check the 24 hour window before a free-form reply.
- GETFetch a single message's delivery report
- GETCheck whether the 24 hour customer-service window is open
WhatsApp Flows
Read your Flows and the answers customers submit inside WhatsApp.
- GETList your WhatsApp Flows
- GETOne Flow in full detail
- GETPaged Flow completions (nfm_reply)
Media
Upload a file to Meta first, then send it in a message. Handy for invoices, images and videos.
- POSTUpload media to Meta ahead of a send
The full and current endpoint list is in the API docs in your dashboard.
Five flows you can build this week
Each flow uses only the endpoints and webhooks shown above, so you can build it with the WhatsApp API for developers today.
- Order status changes
- Your server sends a template
- Customer gets the update
- You read the delivery report
- Customer replies
- Webhook: event_type text
- Your helpdesk opens a ticket
- Agent replies with context.message_id
- Form is submitted
- Template with a button
- Webhook: button_reply
- CRM moves the lead
- Customer fills a Flow
- Webhook: nfm_reply
- You read Flow completions
- Save in your database
- Send a template campaign
- Read the status funnel
- Cancel the unsent rest
- Or move the date
Go deeper, one guide at a time
Each guide covers one job of the WhatsApp API for developers. Start with the send message API.
WhatsApp API for developers: your questions answered
Is a successful API response the same as message delivery?
No. A success response means Koverage accepted your request. The message is then handled by WhatsApp. Use the delivery report endpoint to see what happened to one message.
What do I need before I send my first message?
A Koverage account, a WhatsApp number on the API, your API key and a customer who agreed to hear from you. Then send a POST request with your key as a Bearer token.
When can I send a free-form message?
When the 24 hour customer-service window is open. The API has an endpoint that checks this for a contact. Free-form types go to one contact per request.
When must I use a template?
When the window is closed, or when you start the chat. A template request can include many recipients, up to 1000 by default, and each recipient can have its own parameters.
Which languages can I use?
Any language that can send an HTTPS request. The examples above show cURL, PHP, Python, Node.js, Java, Go and C#.
How do I receive customer replies?
Koverage calls your server with a message_received webhook for each incoming event. It includes event_type, event, text, from, msg_id and timestamp.
How do I reply to one specific message?
Send a message and pass the earlier message id in context.message_id.
Where do I find my API key?
In the API docs in your Koverage dashboard. It sits at the top of the page, next to a Regenerate Key button.
Build your WhatsApp integration with Koverage
Get your key and send your first message with the WhatsApp API for developers. There is no platform fee, and you pay only for messages. See pricing.