Text API object

Hierarchy (view full)

Constructors

Properties

Constructors

  • Create a Text object for the API

    Parameters

    • body: string

      The content of the text message which can contain formatting and URLs which begin with http:// or https://

    • Optionalpreview_url: boolean

      By default, WhatsApp recognizes URLs and makes them clickable, but you can also include a preview box with more information about the link. Set this field to true if you want to include a URL preview box.

    Returns Text

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

    const text_message = new Text("Hello world!");

    const text_preview_message = new Text("Hello URL!", true);

    If body is over 4096 characters

Properties

body: string

Body of the message. Maximum length: 4096 characters.

preview_url?: boolean

Whether to enable preview for the text message