Type alias OnMessageArgs

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

Type declaration

  • Whatsapp: InstanceType<typeof default>

    The WhatsAppAPI instance that emitted the event

  • from: string

    The user's phone number

  • message: ServerMessage

    The messages object

  • Optional name?: string

    The username

  • phoneID: string

    The bot's phoneID

  • raw: PostData

    The raw data from the API

  • reply: ((response, context?, biz_opaque_callback_data?) => Promise<ServerMessageResponse | Response>)
      • (response, context?, biz_opaque_callback_data?): Promise<ServerMessageResponse | Response>
      • A method to easily reply to the user who sent the message

        Parameters

        • response: ClientMessage

          The message to send as a reply

        • Optional context: boolean

          Wether to mention the current message, defaults to false

        • Optional biz_opaque_callback_data: string

          An arbitrary 256B string, useful for tracking

        Returns Promise<ServerMessageResponse | Response>

        WhatsAppAPI.sendMessage return value

Generated using TypeDoc