whatsapp-api-js - v5.2.0
    Preparing search index...

    Class Interactive

    Interactive API object

    Hierarchy (View Summary)

    Index

    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

      Returns Interactive

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

      const interactive_navigate_flow_message = new Interactive(
      new ActionFlow({
      flow_token: "5f9b3b4f-2b7a-4f4f-8f4f-4f4f4f4f4f4f",
      flow_name: "my_welcome_flow", // Can also use flow_id instead
      flow_cta: "Start the Flow!",
      mode: "published",
      flow_action: "navigate", // Default
      flow_action_payload: {
      screen: "FIRST_SCREEN",
      data: { name: "John" }
      }
      }),
      new Body("How was your experience today?")
      );
      import {
      Interactive,
      ActionFlow,
      Body
      } from "whatsapp-api-js/messages";

      const interactive_data_exchange_flow_message = new Interactive(
      new ActionFlow({
      flow_token: "5f9b3b4f-2b7a-4f4f-8f4f-4f4f4f4f4f4f",
      flow_name: "my_welcome_flow", // Can also use flow_id instead
      flow_cta: "Start the Flow!",
      mode: "published",
      flow_action: "data_exchange",
      }),
      new Body("Hello World") ```
      );

      @param action - The action for the interactive message @param body - The body for the interactive message @param header - The header of type text for the interactive message, it may be undefined if not needed @param footer - The footer for the interactive message, it may be undefined if not needed @throws 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:
        | "product"
        | "list"
        | "button"
        | "catalog_message"
        | "product_list"
        | "cta_url"
        | "flow"
        | "location_request_message"

    The type of the interactive message