WaForgeDevelopers

OTP and website

Chat on WhatsApp button

Add a "Chat on WhatsApp" button to your website so visitors can reach your AI agent. One link, no key, no library and no tracking: a free WhatsApp button for any website.

Where the conversation happens. The button opens WhatsApp (the app on a phone, WhatsApp Web or Desktop on a computer) with a chat to your business number. The AI agent answers there, on WhatsApp. It does not show a chat window inside your website.

Before you start #

  • Your WhatsApp number is connected in WaForge and the AI agent is switched on for it (Dashboard, WhatsApp number).
  • You know the number in international format. wa.me needs digits only: no +, no leading 00, no spaces. +974 5555 1234 becomes 97455551234.

Your dashboard shows a ready snippet with your connected number filled in: Dashboard, Data feeds, "Chat on WhatsApp button".

The snippet #

Paste it before </body>. Replace 97455551234 with your number and edit the first message.

HTML
<a id="wa-chat" class="wa-chat" href="https://wa.me/97455551234?text=Hello%2C%20I%20have%20a%20question"
   target="_blank" rel="noopener">Chat on WhatsApp</a>
<style>
  .wa-chat { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: inline-flex; align-items: center;
    min-height: 48px; padding: 12px 20px; border-radius: 999px; background: #0f7a3f; color: #fff;
    font: 600 16px/1.2 system-ui, sans-serif; text-decoration: none; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
  .wa-chat:hover { background: #0b6233; }
  .wa-chat:focus-visible { outline: 3px solid #111; outline-offset: 3px; }
  @media print { .wa-chat { display: none; } }
</style>

It is a plain link, so it works without JavaScript, with the keyboard and with screen readers.

Optional: mention the page in the first message #

On product pages it helps the agent to know what the visitor was looking at. This small script adds the page title to the pre-filled text:

HTML, after the link
<script>
  (function () {
    var a = document.getElementById('wa-chat');
    if (a) a.href = a.href + encodeURIComponent(' (about: ' + document.title + ')');
  })();
</script>

Writing the pre-filled text #

  • Encode it for a URL: spaces become %20, a comma %2C, a question mark %3F. In JavaScript, encodeURIComponent('Hello, I have a question') does it for you.
  • Arabic and French text work; they are encoded the same way.
  • The visitor can edit the text before sending. Nothing is sent until they press send.

What happens next #

  1. The visitor taps the button and sends the message from their own WhatsApp.
  2. Your AI agent replies on WhatsApp, using your business setup and your connected data for prices and stock.
  3. When the agent needs a person, the chat moves to your WaForge inbox and you are alerted.

New numbers warm up. WhatsApp watches new numbers closely. A visitor writing to you first is fine, but avoid sending bulk messages from the same number. See the safety tips on your WhatsApp number page.