Tasks
Answer WhatsApp Call
Answers a ringing WhatsApp call and connects the caller to a live AI voice call. Useful for voice assistants that pick up calls to your WhatsApp number.
When a WhatsApp user calls your number, the stub gets an _update_from_whatsapp with is_incoming_call set to true. To pick up, start a voice call with Start Voice Chat on the whatsapp channel, then run this task with the call and the new voice call.
The task waits until the call is connected and the caller can hear the assistant, usually within 2 seconds, and then returns. From then on the call works like any live voice call: the stub steers it with voice notifications and gets _update_from_voice updates, including when the call ends.
The call must be answered within 25 seconds of the incoming call event. After that it's rejected automatically, and the stub gets a missed call event instead.
Basic usage
Parameters
comwhatsappcalluuid required string
The id of the call, from stubpost.data._incoming_whatsapp_data.call_data.comwhatsappcalluuid on the incoming call event.
voice_session_uuid required string
The voice call to connect the caller to, from the Start Voice Chat result. Start it with "channel": "whatsapp".
WhatsApp calls need an audio/pcm format, which is the whatsapp channel's default. Don't set audio.format to audio/pcmu or audio/pcma for WhatsApp calls.
Result
Properties
payload.status string
answered: the caller is connected to the assistant.
payload.comwhatsappcalluuid string
The id of the call that was answered.
payload.audio.format object
The audio format of the voice call.
Errors
These are conceptual errors. If the caller hung up before or while the call was answered, the stub also gets a missed call event with the reason caller_hangup.
When answering fails along the way, the task returns a technical error, and error.details.step says where it failed. The caller's call ends, and the voice call ends as abandoned by itself, with a session_ended _update_from_voice.
Examples
Answer every incoming call
On the action that receives _update_from_whatsapp, start the voice call and answer. Both tasks use is_incoming_call as their condition, so they don't run for messages or missed calls. The greeting makes the assistant speak first.
Answer calls from a call button
When a call comes from a call button in a message you sent, call_data.cta_payload has the button's payload. Answer only those calls, and reject the rest with Reject WhatsApp Call:
End the call
There is no task to hang up a WhatsApp call. End the voice call as usual, eg with a hangup voice notification or the Voice Hangup task. The assistant says goodbye, then the WhatsApp call ends.