Skip to content
WhatsApp Widget

Menu

Type to search the docs.

↑ ↓ move · Enter open · Esc close

Options

Every option of the widget and of an agent, with its type and what it does.

new whatsapp(options) takes the options of the widget, and agents takes a list of agents. Text in every option has its HTML tags removed before it is shown.

Widget options

OptionTypeDefaultWhat it does
titleString¿Necesitas ayuda?The heading of the panel, and the tooltip of the button.
descriptionStringChatea con nosotros por WhatsappThe line under the heading.
agentsArray[]The people the visitor can write to. With no agents nothing is drawn.

Agent options

OptionTypeWhat it does
nameStringThe name shown for the agent, and part of the tooltip of its entry.
phoneStringThe WhatsApp number. The spaces and the + are removed to build the chat address, so +57 320 1234567 works.
hoursStringA text shown under the name, such as Disponible 9am - 6pm. It is only a label, see below.
ctaStringThe call to action, such as Haz clic para iniciar chat.
messageStringThe text the chat starts with. Leave it out and the chat opens empty.
scheduleArrayThe days and times when the agent is available. Leave it out and the agent is always available.

hours does not decide when an agent is available. schedule does. Write both, so that what the visitor reads matches what the widget does.

Example

new whatsapp({
  title: "¿Necesitas ayuda?",
  description: "Chatea con nosotros por Whatsapp",
  agents: [
    {
      name: "Servicio al cliente",
      phone: "+57 320 1234567",
      hours: "Disponible 9am - 6pm",
      cta: "Haz clic para iniciar chat",
      message: "Hola, me gustaría obtener más información",
      schedule: [
        ["9:00", "18:00"], // Sunday
        ["9:00", "20:00"],
        ["9:00", "20:00"],
        ["9:00", "20:00"],
        ["9:00", "20:00"],
        ["9:00", "22:00"],
        ["10:00", "18:00"], // Saturday
      ],
    },
  ],
});

Analytics

If the page has window.dataLayer, the widget pushes an event to it when the button is clicked and when an agent is clicked. The event is ga_event, with the category Widget WhatsApp and the action Click WhatsApp. The label is Click Icono for the button and the name of the agent for an agent. A page without window.dataLayer is not affected.

Edit this page

Last updated