Type Alias OnMessageArgs

OnMessageArgs: {
    from: string;
    message: ServerMessage;
    name?: string;
    offload: typeof offload;
    phoneID: string;
    raw: PostData;
    reply: (
        response: ClientMessage,
        context?: boolean,
        biz_opaque_callback_data?: string,
    ) => Promise<ServerMessageResponse | Response>;
    Whatsapp: InstanceType<typeof WhatsAppAPI>;
}

Type declaration

  • from: string

    The user's phone number

  • message: ServerMessage

    The messages object

  • Optionalname?: 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

  • raw: PostData

    The raw data from the API

  • reply: (
        response: ClientMessage,
        context?: boolean,
        biz_opaque_callback_data?: string,
    ) => Promise<ServerMessageResponse | Response>

    A method to easily reply to the user who sent the message

  • Whatsapp: InstanceType<typeof WhatsAppAPI>

    The WhatsAppAPI instance that emitted the event