Skip to content

Calling

Whatomate provides WebRTC-based voice calling over WhatsApp. This page documents the HTTP/REST control-plane endpoints: browsing call logs and recordings, managing agent transfers, placing outgoing calls, and requesting call permission.

Permissions used on this page: call_logs:read, call_transfers:read, call_transfers:write, outgoing_calls:read, outgoing_calls:write.


Get call logs for the organization.

Terminal window
GET /api/call-logs
ParameterTypeDescription
statusstringFilter by status (ringing, answered, completed, missed, rejected, failed, transferring, initiating, accepted)
accountstringFilter by WhatsApp account name
contact_idstringFilter by contact UUID
directionstringincoming or outgoing
ivr_flow_idstringFilter by IVR flow UUID
phonestringPartial match on the caller phone number
start_datestringInclude calls created on or after this date
end_datestringInclude calls created on or before this date
pageintegerPage number (default 1)
limitintegerResults per page
{
"status": "success",
"data": {
"call_logs": [
{
"id": "uuid",
"organization_id": "uuid",
"whatsapp_account": "Main",
"contact_id": "uuid",
"whatsapp_call_id": "wacid.HBg...",
"caller_phone": "+15551234567",
"direction": "incoming",
"status": "completed",
"duration": 92,
"ivr_flow_id": "uuid",
"agent_id": "uuid",
"started_at": "2024-01-01T00:00:00Z",
"answered_at": "2024-01-01T00:00:05Z",
"ended_at": "2024-01-01T00:01:37Z",
"disconnected_by": "agent",
"recording_duration": 92,
"contact": { "id": "uuid", "phone_number": "+15551234567" },
"agent": { "id": "uuid", "full_name": "Jane Agent" }
}
],
"total": 1,
"page": 1,
"limit": 20
}
}

Get a single call log with its associated transfers.

Terminal window
GET /api/call-logs/{id}
{
"status": "success",
"data": {
"call_log": {
"id": "uuid",
"whatsapp_account": "Main",
"caller_phone": "+15551234567",
"direction": "incoming",
"status": "completed",
"duration": 92,
"ivr_path": ["1", "3"],
"agent_id": "uuid"
},
"transfers": [
{
"id": "uuid",
"status": "completed",
"team_id": "uuid",
"agent_id": "uuid",
"talk_duration": 80
}
]
}
}

Get a short-lived presigned URL for a call's audio recording. Requires S3 storage to be configured and the call to have a recording.

Terminal window
GET /api/call-logs/{id}/recording
{
"status": "success",
"data": {
"url": "https://s3.example.com/recordings/...?X-Amz-Expires=900",
"duration": 92
}
}

Put an active call on hold and play hold music to the caller. The {id} is the call log ID.

Terminal window
POST /api/call-logs/{id}/hold
{
"status": "success",
"data": {
"status": "on_hold"
}
}

Take an active call off hold and restore the audio bridge.

Terminal window
POST /api/call-logs/{id}/resume
{
"status": "success",
"data": {
"status": "connected"
}
}

Call transfers move a live call from the IVR (or from another agent) to an agent or team. See IVR Flows for how transfers are triggered from a flow.

Terminal window
GET /api/call-transfers
ParameterTypeDescription
statusstringFilter by status (waiting, connected, completed, abandoned, no_answer)
pageintegerPage number (default 1)
limitintegerResults per page
{
"status": "success",
"data": {
"call_transfers": [
{
"id": "uuid",
"organization_id": "uuid",
"call_log_id": "uuid",
"whatsapp_call_id": "wacid.HBg...",
"caller_phone": "+15551234567",
"contact_id": "uuid",
"whatsapp_account": "Main",
"status": "waiting",
"team_id": "uuid",
"agent_id": null,
"initiating_agent_id": null,
"transferred_at": "2024-01-01T00:00:00Z",
"hold_duration": 0,
"talk_duration": 0
}
],
"total": 1,
"page": 1,
"limit": 20
}
}
Terminal window
GET /api/call-transfers/{id}
{
"status": "success",
"data": {
"id": "uuid",
"call_log_id": "uuid",
"caller_phone": "+15551234567",
"status": "connected",
"team_id": "uuid",
"agent_id": "uuid",
"connected_at": "2024-01-01T00:00:10Z",
"talk_duration": 0
}
}

An agent accepts a waiting transfer and completes the WebRTC handshake. The agent sends an SDP offer and receives the SDP answer. Concurrent accepts are rejected atomically.

Terminal window
POST /api/call-transfers/{id}/connect
{
"sdp_offer": "v=0\r\no=- ... (WebRTC SDP offer)"
}
FieldTypeRequiredDescription
sdp_offerstringYesThe agent's WebRTC SDP offer
{
"status": "success",
"data": {
"sdp_answer": "v=0\r\no=- ... (WebRTC SDP answer)"
}
}

End a connected transfer.

Terminal window
POST /api/call-transfers/{id}/hangup
{
"status": "success",
"data": {
"status": "completed"
}
}

A connected agent transfers their active call to another team (optionally targeting a specific agent within that team).

Terminal window
POST /api/call-transfers/initiate
{
"call_log_id": "uuid",
"team_id": "uuid",
"agent_id": "uuid"
}
FieldTypeRequiredDescription
call_log_idstringYesThe active call's log UUID
team_idstringYesTarget team UUID
agent_idstringNoTarget a specific agent (must be a member of team_id)
{
"status": "success",
"data": {
"status": "transferring"
}
}

Start a voice call from an agent to a WhatsApp contact. The agent provides an SDP offer and receives the SDP answer plus the new call log ID.

Terminal window
POST /api/calls/outgoing
{
"contact_id": "uuid",
"whatsapp_account": "Main",
"sdp_offer": "v=0\r\no=- ... (WebRTC SDP offer)"
}
FieldTypeRequiredDescription
contact_idstringYesContact UUID to call
whatsapp_accountstringYesWhatsApp account name to place the call from
sdp_offerstringYesThe agent's WebRTC SDP offer
{
"status": "success",
"data": {
"call_log_id": "uuid",
"sdp_answer": "v=0\r\no=- ... (WebRTC SDP answer)"
}
}

End an outgoing call. The {id} is the call log ID returned by the initiate call.

Terminal window
POST /api/calls/outgoing/{id}/hangup
{
"status": "success",
"data": {
"status": "ok"
}
}

WhatsApp requires the consumer to grant call permission before a business can call them. This sends the permission-request message and records it.

Terminal window
POST /api/calls/permission-request
{
"contact_id": "uuid",
"whatsapp_account": "Main"
}
FieldTypeRequiredDescription
contact_idstringYesContact UUID to request permission from
whatsapp_accountstringYesWhatsApp account name
{
"status": "success",
"data": {
"permission_id": "uuid"
}
}

Check the live call-permission state for a contact directly via the WhatsApp API. The path parameter is the contact UUID.

Terminal window
GET /api/calls/permission/{contactId}?whatsapp_account=Main
ParameterTypeRequiredDescription
whatsapp_accountstringYesWhatsApp account name
{
"status": "success",
"data": {
"status": "approved"
}
}

Return the configured ICE (STUN/TURN) servers the frontend should use when building WebRTC peer connections. TURN entries may carry short-lived, HMAC-derived credentials that are generated per request.

Terminal window
GET /api/calls/ice-servers
{
"status": "success",
"data": {
"ice_servers": [
{
"urls": ["stun:stun.example.com:3478"]
},
{
"urls": ["turn:turn.example.com:3478?transport=udp"],
"username": "1735689600",
"credential": "hmac-derived-credential"
}
]
}
}
  • Calling - Voice calling architecture and configuration
  • IVR Flows - Build the IVR menus that route callers to agents