Incoming Calls

This section covers APIs used to receive, accept, decline, and maintain incoming WhatsApp calls.


Accept Incoming Call

Accepts an incoming WhatsApp call and joins the call session.

Endpoint

POST /whatsapp/accept

Permission Required

RECEIVE_CALL (validated against callId)


Request Body

FieldTypeRequiredDescription
callIdstringYesCall ID from incoming call event
sdpstringYesWebRTC SDP offer
sdpTypestringYesSDP type ("answer")
reconnectbooleanNoSet to true for reconnections
deviceIdstringNoClient device identifier

Response (200)

{
  "success": true,
  "message": "Call answered",
  "data": { ... },
  "event": "CALL_ACCEPTED",
  "wabaName": "<waba-display-name>",
  "wabaNumber": "<waba-number>",
  "customerName": "<customer-name>",
  "customerNumber": "<customer-number>",
  "callStartedAt": "<ISO8601>",
  "chatId": "<chat-id>",
  "customer": {
    "name": "<customer-name-or-number>",
    "phoneNumber": "<customer-number>"
  }
}

Decline or End Call

Declines an incoming call or ends an active call.

Endpoint

POST /whatsapp/decline

Permission Required

RECEIVE_CALL (validated against callId)


Request Body

FieldTypeRequiredDescription
callIdstringYesCall ID to decline or end

Response (200)

{
  "success": true,
  "message": "Call declined",
  "data": { ... },
  "callStatus": "REJECT",
  "customer": {
    "name": "<customer-name-or-number>",
    "phoneNumber": "<customer-number>"
  }
}

callStatus values

  • REJECT – Call was not answered
  • END – Call was already in progress

Keep Call Alive (Ping)

Prevents the call from closing due to inactivity.

Endpoint

GET /whatsapp/call/ping

Permission Required

RECEIVE_CALL (validated against callId)


Query Parameters

ParameterTypeRequiredDescription
callIdstringYesCall ID to keep alive

Response (200)

{}

Errors

  • 400callId missing
  • 422 – Call not found, already closed, or user is not the active call participant