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

    Class Audio

    Audio API component

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Constructors

    • Create an Audio object for the API

      Setting voice to true adds transcriptions support, auto download, and the "played" status is sent when heard by the recipient. The file should be .ogg with OPUS codec for full voice note support.

      Parameters

      • audio: string

        The audio file's link or id

      • isItAnID: boolean = false

        Whether audio is an id (true) or a link (false)

      • Optionalvoice: boolean

        Whether the audio is a voice note

      Returns Audio

      import { Audio } from "whatsapp-api-js/messages";

      const audio_message = new Audio("https://www.example.com/audio.mp3");

      const audio_id_message = new Audio("12345678", true);

      const voice_message = new Audio("https://www.example.com/audio.ogg", false, true);

    Properties

    id?: string

    The id of the media

    link?: string

    The link of the media

    voice?: boolean

    Whether the audio is a voice note