Tasks
Reject WhatsApp Call
Declines a ringing WhatsApp call. Useful for turning away calls the template doesn't want to take, eg calls that didn't come from a call button.
When a WhatsApp user calls your number, the stub gets an _update_from_whatsapp with is_incoming_call set to true. Run this task to decline the call instead of answering it with Answer WhatsApp Call.
The caller sees that the call was declined. Shortly after, the stub gets an _update_from_whatsapp for a missed call, with call_data.reason set to rejected, so you can follow up, eg with a WhatsApp message.
A call that is neither answered nor rejected is rejected automatically after 25 seconds, with the reason answer_timeout. Reject a call yourself when you already know you won't take it, so the caller isn't left waiting.
To stop calls outside business hours, set call hours in the WhatsApp profile's calling settings instead. WhatsApp then tells callers you're closed before the call is placed.
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. The call must still be ringing.
Result
Properties
payload.status string
rejected: the call was declined.
payload.comwhatsappcalluuid string
The id of the call that was rejected.
Errors
These are conceptual errors. When WhatsApp couldn't be reached to decline the call, the task returns a technical error. The call then keeps ringing until WhatsApp gives up on it, after 30 to 60 seconds, and the stub gets the missed call event.
Examples
Reject calls while the stub is busy
Decline calls when the stub is in a state where nobody should take them, and let the caller know by message after the missed call event:
Follow up on a rejected call
The missed call event arrives on _update_from_whatsapp too. Send a message when the reason is rejected:
Reject calls that didn't come from a call button
See Answer calls from a call button on Answer WhatsApp Call.