Guide
WhatsApp Calls API: make and receive WhatsApp calls
Flow API can place and answer WhatsApp voice calls on your number. Talk from the browser, connect your own app over WebRTC, and get every call in your webhooks and call journal. Free during the beta.
Steps
- 1Open your number in the Flow API console and go to the Calls tab.
- 2Scan the calls QR code once from WhatsApp → Settings → Linked devices. Messaging keeps working as before.
- 3Type a number and press Call, or answer incoming calls right in the browser.
- 4From code: call callsDial, then send your WebRTC offer over the callsRtc WebSocket.
Start a call from code
POST https://flowapi.pro/waInstance{idInstance}/callsDial/{apiTokenInstance}
{"chatId":"972501234567@c.us"}
→ {"callId":"AC0E17D82A7B513089A667F636DD2AE5"}Talk from a browser or app (WebRTC)
const ws = new WebSocket("wss://flowapi.pro/waInstance{idInstance}/callsRtc/{apiTokenInstance}");
const pc = new RTCPeerConnection({ iceServers: [{ urls: "stun:stun.l.google.com:19302" }] });
const mic = await navigator.mediaDevices.getUserMedia({ audio: true });
mic.getTracks().forEach((t) => pc.addTrack(t, mic));
pc.ontrack = (e) => { audio.srcObject = e.streams[0]; };
pc.onicecandidate = (e) => e.candidate && ws.send(JSON.stringify({ type: "ice-candidate", candidate: e.candidate }));
ws.onmessage = async ({ data }) => {
const m = JSON.parse(data);
if (m.type === "state" && m.state.state === "out-call") { // after callsDial (or callsAccept)
await pc.setLocalDescription(await pc.createOffer());
ws.send(JSON.stringify({ type: "offer", offer: pc.localDescription }));
}
if (m.type === "answer") await pc.setRemoteDescription(m.answer);
if (m.type === "ice-candidate") await pc.addIceCandidate(m.candidate);
};Answer incoming calls
- The callsRtc WebSocket sends a state message with inc-call and the caller's number and name.
- Call callsAccept to answer and then send your WebRTC offer, or callsReject to decline.
- callsHangUp ends the call; callsState shows the current state at any time.
Call webhooks and journals
- incomingCall: status offer, then pickUp, hungUp or declined.
- outgoingCall: one notification when an API call ends, with duration and result.
- Turn them on with incomingCallWebhook and outgoingCallWebhook in setSettings or the Settings tab.
- lastIncomingCalls and lastOutgoingCalls return the call history.
Questions
Is it compatible with Green API?
Yes. The methods, the callsRtc WebSocket messages and the call webhooks follow Green API's calls format, so existing integrations only change the host.
Does it cost extra?
Calls are free during the beta.
Do I need the WhatsApp Business API?
No. It works with the regular WhatsApp and WhatsApp Business apps, linked like WhatsApp Web.
Group or video calls?
Not yet. Calls are one-to-one voice calls.
Try it on your own number
7 days free, no credit card. Then $10 per number per month.