Portfolio Supported AIs Solutions Tasks Email Archive Bring Your Own Code Integrations Pricing

Get Started

ChatGPT

ChatGPT

Start directly →

Ready
Claude

Claude

Directory Connector →

Ready
Mistral

Mistral

Directory Connector →

Ready

Dashboard Always available
← All articles

whatsapp chat widget

WhatsApp Chat Widget: How to Add One to Your Site

Add a WhatsApp chat widget to your website or app: how click-to-chat links work, how to build the button, and how to test it. Live on your site right away.

A WhatsApp chat widget is a button on your page that opens a WhatsApp chat with your business number. You can add one in a few minutes. With WhatsApp, the chat opens in the WhatsApp app, not on your page. On WebsitePublisher, the AI web platform for websites and apps, you tell your AI assistant where the button goes. The assistant builds it through the WebsitePublisher connector, and the change is live immediately.

TL;DR

  • A WhatsApp chat widget is a styled link. WhatsApp’s own help page describes it as https://wa.me/ plus your full international number.
  • The link itself costs nothing. You only need a number that is registered on WhatsApp.
  • A prefilled message goes in a ?text= parameter, and it must be URL-encoded.
  • Add the button once, in a layout shared by every page, then test it on a phone that does not have your number saved.
  • On WebsitePublisher, your AI assistant (ChatGPT, Claude, Gemini, Grok and others) adds the button to your website or app, and every change is live immediately.

Table of Contents

What a WhatsApp chat widget actually is

People search for this in several ways: a chat widget, a click-to-chat button, a WhatsApp icon on a website. They all point to the same family of tools, which comes in three levels.

  1. A click-to-chat link. A plain URL that hands the visitor to WhatsApp. WpChat describes it as the wa.me route, where the customer messages first.
  2. A widget or floating button. The same link inside a styled button with display settings, such as position and a greeting.
  3. The WhatsApp Business Platform. A number connected to Meta’s API for automation, several agents and a CRM.

One point saves a lot of confusion. WhatsApp Web only permits framing from WhatsApp’s own domains, so a true in-page WhatsApp window does not exist. Every “embed” is a styled link or a small panel that then opens WhatsApp.

That also means WhatsApp is not the same as live chat. A web live chat keeps visitors on your page. WhatsApp chats are asynchronous: people do not expect instant replies, because that is not how they use the app with friends.

Everything starts with the link. Here is the format from WhatsApp’s Help Center:

https://wa.me/15551234567

The rules:

  • Use the full phone number in international format.
  • Leave out zeroes, brackets, dashes and the plus sign.
  • The number must be registered on WhatsApp, or visitors see an error instead of a chat.

For a US number, that means the country code 1 followed by the ten digits.

Add a prefilled message

Add ?text= and the message after the number:

https://wa.me/15551234567?text=Hi%20there%2C%20I%20have%20a%20question

The message shows up in the visitor’s text field. Nothing is sent until they tap send. If you leave the number out, WhatsApp shows a contact picker instead, so keep it in.

The message has to be URL-encoded. Chatfuel’s encoding table gives the common ones:

Character Encoded
Space %20
Line break %0A
& %26
# %23
? %3F

Accented letters and emoji need encoding too.

SendSeven lists the usual ones: a plus sign or a leading zero after the country code, unencoded spaces, and an unencoded & or # that cuts off the rest of the message. Check these first when a button opens the wrong chat or an empty one.

Add the button to your page

A button is an anchor tag with a visible icon. SendSeven suggests opening it in a new tab with target="_blank" and rel="noopener", a 56px size (44px is the minimum for touch targets), and an aria-label so screen readers announce it.

Business owner testing a website chat button

If you use WhatsApp’s own “Chat on WhatsApp” artwork, follow its rules. It comes in green and white, in three sizes, and should be used unmodified.

Where you place it matters more than how it looks:

  • Once, in a shared layout. WeSpeak’s setup guide says the code should load once, on every page, inside the body, usually just before the closing body tag.
  • Not over key controls. Alpha warns that a floating button covering checkout controls or a mobile form does more harm than good.
  • Hosted on your own server. SendSeven notes that loading the icon from a third-party server sends your visitors’ IP addresses on every page view.

The usual way: paste code into a builder

Most hosted builders have a custom-code field. On Wix, for example, the Embed HTML element runs in a sandboxed iframe, so site-wide code goes in Settings, then Custom Code, on a premium plan with a connected domain. You then clear caches and check the live page, not the editor. It works, but you are doing the placement by hand on every site.

On WebsitePublisher

WebsitePublisher is a full-stack AI web platform for websites and apps. Your AI assistant, whether ChatGPT, Claude, Gemini, Grok or another, builds and publishes through the WebsitePublisher connector, which uses MCP (the Model Context Protocol). Here are the steps:

  1. Connect your AI assistant to WebsitePublisher.
  2. Tell it: “Add a floating WhatsApp button, bottom right, linking to wa.me with my number and this prefilled message.”
  3. Say which pages need it. Ask for the shared layout so the button appears on all of them.
  4. Open the page. The change is live immediately, with no separate publish step.
  5. Want a different position or message? Ask again, or adjust the content in the visual browser editor.

Project memory stays across sessions and assistants, so the number and message are not lost if you switch AI. For more prompts to start from, see our prompt library.

Two choices hide inside “WhatsApp on my website.” Crafixx separates them well: how visitors reach you (link, button, or form), and where the chat lands (the WhatsApp Business app on one number, or the Business Platform tied to a CRM).

For most small sites, a link and the WhatsApp Business app cover it. The platform route starts to matter when you want automated replies, several agents, or messages to flow into a bigger system. Businesses can connect directly through Meta’s APIs or through an approved provider.

If you go the platform route, two things are worth knowing:

  • Customers start the conversation, which opens a 24-hour window for free-form replies. Messages you send first need pre-approved templates and prior opt-in.
  • Incoming messages are free. Meta charges per delivered message by category, and since October 1, 2026, service messages are charged after the first 1,000 free per business number each month. Rates differ by country, so check Meta’s current rate card.

If your site also needs a CRM or webhooks behind the chat, we cover those in CRM integration for your website and website webhook setup.

Test the button before you rely on it

Run this short check on every site:

  1. Use a phone that does not have your number saved. This shows what a real visitor sees.
  2. Confirm the number has an active WhatsApp account. Otherwise visitors get an error.
  3. Tap it on mobile and desktop. The link works on phones and on WhatsApp Web.
  4. Check the prefilled text. Look for cut-off messages caused by unencoded characters.
  5. Look at the layout. The button must not cover your main call to action, a cart or a form.
  6. Check speed. A plain link adds no performance or tracking footprint. A third-party script adds JavaScript and requests, so compare mobile results with and without it in PageSpeed Insights or Lighthouse.
  7. Check accessibility. Look for readable contrast, a large touch target and an accessible name. Our accessibility checklist has more tests.

Privacy counts too. Under EU rules, a hosted widget’s third-party script should sit behind consent, while a plain link stores nothing until it is clicked. If a widget collects a phone number, your privacy notice needs to cover it. Sinch also recommends asking people to opt in, for example with a checkbox in a pop-up.

Other chat tools on the same site

WhatsApp suits people who already live in the app. If you also want an on-page chat that keeps visitors on the site, our guides cover adding an AI chatbot in under 15 minutes, HubSpot chat and Intercom. They can sit next to a WhatsApp button as separate entry points.

Build the whole site, not just the button

A chat button is one piece. WebsitePublisher is a full-stack AI web platform for websites and apps. Hosting, auth, payments, forms, email, uploads and data are built in, and your AI snaps together 140+ tested integrations instead of generating untested glue code. That suits freelancers with a quick portfolio, small businesses, and agencies running several client sites, where each site needs the same button with a different number.

Websitepublisher

See the plans on our pricing page, which includes a Free plan, or start from the WebsitePublisher home page.

Our view

We think the entry point should be the simplest part of your setup. A WhatsApp button is a link with a number in it. It should not cost you an afternoon.

That is why we built WebsitePublisher around conversation. You tell your AI assistant what you want on the page, it builds it through the connector, and the change is live immediately. Because the platform is full-stack, the form, the data and the email behind your site live in the same place as the button.

Project memory also stays across sessions and assistants. Switch from one AI to another and the number, the message and the placement are still known. Start with the link. Add a bigger messaging setup when your volume calls for it.

FAQ

Is a WhatsApp chat widget free?

The click-to-chat link and a simple button cost nothing. Incoming messages are always free. Costs come only from replies sent through the WhatsApp Business Platform and from any software your team uses.

Can I show the WhatsApp chat inside my page?

No. The chat opens in the WhatsApp app or WhatsApp Web, because WhatsApp Web only allows framing from its own domains. A widget is a styled button or a panel that hands the visitor over to WhatsApp.

Why does my button show an error or the wrong chat?

The usual causes are a number that is not registered on WhatsApp, a plus sign or leading zero, or an unencoded character in the message. Use the digits only, with the country code first, as in WhatsApp’s guidance.

Do I need the WhatsApp Business API?

Only if you want to message customers first with templates, automate replies, or connect several agents and a CRM. For a button that lets visitors start a chat, a link and the WhatsApp Business app are enough.

How do I add the button to a site built with WebsitePublisher?

Ask your AI assistant to add a floating WhatsApp button with your number and a prefilled message to the shared layout. Every change is live immediately.

Sources

Build your site the same way

Describe what you want. Your AI builds and publishes it — with the full stack behind it: data, auth, forms, payments, integrations and hosting.

See how it works →