whatsapp-api-js - v6.1.0
    Preparing search index...

    Type Alias OnCallConnectArgs

    type OnCallConnectArgs = {
        accept: (
            biz_opaque_callback_data?: string,
        ) => ReturnType<WhatsAppAPI["acceptCall"]>;
        call: ServerCallConnect;
        from: string;
        name?: string;
        offload: typeof offload;
        phoneID: string;
        preaccept: () => ReturnType<WhatsAppAPI["preacceptCall"]>;
        raw: PostData;
        reject: () => ReturnType<WhatsAppAPI["rejectCall"]>;
        terminate: () => ReturnType<WhatsAppAPI["rejectCall"]>;
        Whatsapp: InstanceType<typeof WhatsAppAPI>;
    }
    Index

    Properties

    accept: (
        biz_opaque_callback_data?: string,
    ) => ReturnType<WhatsAppAPI["acceptCall"]>

    A method to easily accept the call after the WebRTC connection. It's strongly recommended to call OnCallArgs.preaccept first

    Type declaration

    The connection call object

    from: string

    The user's phone number

    name?: string

    The username

    offload: typeof offload

    Utility function for offloading code from the main thread, useful for long running tasks such as AI generation

    phoneID: string

    The bot's phoneID

    preaccept: () => ReturnType<WhatsAppAPI["preacceptCall"]>

    A method to easily preaccept the call, before establishing the WebRTC connection.

    Type declaration

    The raw data from the API

    reject: () => ReturnType<WhatsAppAPI["rejectCall"]>

    A method to easily reject the call, before establishing the WebRTC connection.

    Type declaration

    terminate: () => ReturnType<WhatsAppAPI["rejectCall"]>

    A method to easily terminate the call, after establishing the WebRTC connection.

    Type declaration

    This shouldn't be used within the OnCall callback, unless you expect your calls to be super short, wants to lock the main loop, or will pass the function as a callback to another method.

    Whatsapp: InstanceType<typeof WhatsAppAPI>

    The WhatsAppAPI instance that emitted the event