Interactive API object

Hierarchy (view full)

Constructors

Properties

Constructors

  • Creates an Interactive Reply Buttons object for the API

    Parameters

    • action: ActionButtons

      The action for the interactive message

    • body: Body

      The body for the interactive message

    • Optionalheader: Header

      The header for the interactive message, it may be undefined if not needed

    • Optionalfooter: Footer

      The footer for the interactive message, it may be undefined if not needed

    Returns Interactive

    import {
    Interactive,
    ActionButtons,
    Button,
    Body
    } from "whatsapp-api-js/messages";

    const interactive_button_message = new Interactive(
    new ActionButtons(
    new Button("reply_1", "Hello"),
    new Button("reply_2", "World")
    ),
    new Body("Hello World")
    );
  • Creates an Interactive List object for the API

    Parameters

    • action: ActionList

      The action for the interactive message

    • body: Body

      The body for the interactive message

    • Optionalheader: Header

      The header of type text for the interactive message, it may be undefined if not needed

    • Optionalfooter: Footer

      The footer for the interactive message, it may be undefined if not needed

    Returns Interactive

    import { Interactive, ActionList, Row, Body } from "whatsapp-api-js/messages";

    const interactive_list_message = new Interactive(
    new ActionList(
    "Button text",
    new ListSection(
    "Section title",
    new Row("reply_1", "Hello", "Hello description"),
    new Row("reply_2", "World", "World description")
    )
    ),
    new Body("Hello World")
    );

    If a header is provided and it's not of type "text"

  • Creates an Interactive Catalog object for the API

    Parameters

    • action: ActionCatalog

      The action for the interactive message

    • body: Body

      The body for the interactive message

    • Optionalheader: undefined

      Undefined

    • Optionalfooter: Footer

      The footer for the interactive message, it may be undefined if not needed

    Returns Interactive

    import {
    Interactive,
    ActionCatalog,
    Product,
    Body
    } from "whatsapp-api-js/messages";

    const interactive_catalog_message = new Interactive(
    new ActionCatalog(new Product("hello")),
    new Body("Hello World")
    );
  • Creates an Interactive Single Product object for the API

    Parameters

    • action: ActionProduct

      The action for the interactive message

    • Optionalbody: Body

      The body for the interactive message

    • Optionalheader: undefined

      Undefined

    • Optionalfooter: Footer

      The footer for the interactive message, it may be undefined if not needed

    Returns Interactive

    import { Interactive, ActionProduct, Product } from "whatsapp-api-js/messages";

    const interactive_single_product_message = new Interactive(
    new ActionProduct("catalog_id", new Product("product_id"))
    );
  • Creates an Interactive Multi Product object for the API

    Parameters

    • action: ActionProductList

      The action for the interactive message

    • body: Body

      The body for the interactive message

    • header: Header

      The header of type text for the interactive message

    • Optionalfooter: Footer

      The footer for the interactive message, it may be undefined if not needed

    Returns Interactive

    import {
    Interactive,
    ActionProductList,
    ProductSection,
    Product
    } from "whatsapp-api-js/messages";

    const interactive_multi_product_message = new Interactive(
    new ActionProductList(
    "catalog_id",
    new ProductSection(
    "Product section title",
    new Product("product_id"),
    new Product("product_id")
    )
    ),
    new Body("Hello World"),
    new Header("Hello World Header")
    );

    If header is not of type "text"

  • Creates an Interactive CTA object for the API

    Parameters

    • action: ActionCTA

      The action for the interactive message

    • body: Body

      The body for the interactive message

    • Optionalheader: Header

      The header of type text for the interactive message, it may be undefined if not needed

    • Optionalfooter: Footer

      The footer for the interactive message, it may be undefined if not needed

    Returns Interactive

    import { Interactive, ActionCTA, Body } from "whatsapp-api-js/messages";

    const interactive_catalog_message = new Interactive(
    new ActionCTA("Open Google", "https://google.com"),
    new Body("You should google it")
    );

    If a header is provided and it's not of type "text"

  • Creates an Interactive Flow object for the API

    Parameters

    • action: ActionFlow

      The action for the interactive message

    • body: Body

      The body for the interactive message

    • Optionalheader: Header

      The header of type text for the interactive message, it may be undefined if not needed

    • Optionalfooter: Footer

      The footer for the interactive message, it may be undefined if not needed

    Returns Interactive

    import {
    Interactive,
    ActionNavigateFlow,
    Body
    } from "whatsapp-api-js/messages";

    const interactive_navigate_flow_message = new Interactive(
    new ActionNavigateFlow(
    "5f9b3b4f-2b7a-4f4f-8f4f-4f4f4f4f4f4f",
    "5f9b3b4f-2b7a-4f4f-8f4f-4f4f4f4f4f4f",
    "Hello World",
    "form_screen",
    {
    name: "John Doe",
    age: 42
    }
    ),
    new Body("How was your experience today?")
    );
    import {
    Interactive,
    ActionDataExchangeFlow,
    Body
    } from "whatsapp-api-js/messages";

    const interactive_data_exchange_flow_message = new Interactive(
    new ActionDataExchangeFlow(
    "5f9b3b4f-2b7a-4f4f-8f4f-4f4f4f4f4f4f",
    "5f9b3b4f-2b7a-4f4f-8f4f-4f4f4f4f4f4f",
    "Hello World"
    ),
    new Body("Hello World")
    );

    If a header is provided and it's not of type "text"

  • Creates an Interactive Location request object for the API

    Parameters

    • action: ActionLocation

      The action for the interactive message

    • body: Body

      The body of the interactive message

    Returns Interactive

    import { Interactive, ActionLocation, Body } from "whatsapp-api-js/messages";

    const interactive_catalog_message = new Interactive(
    new ActionLocation(),
    new Body("Show me where you live")
    );

Properties

The action for the interactive message

body?: Body

The body for the interactive message

footer?: Footer

The footer for the interactive message

header?: Header

The header for the interactive message

type:
    | "list"
    | "button"
    | "catalog_message"
    | "product"
    | "product_list"
    | "cta_url"
    | "flow"
    | "location_request_message"

The type of the interactive message