<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Golam Rabbani</title>
    <description>The latest articles on DEV Community by Golam Rabbani (@golamrabbaninafiz).</description>
    <link>https://dev.to/golamrabbaninafiz</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4235207%2F11fd9c16-499b-41ab-b3b6-232ca8c721c8.png</url>
      <title>DEV Community: Golam Rabbani</title>
      <link>https://dev.to/golamrabbaninafiz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/golamrabbaninafiz"/>
    <language>en</language>
    <item>
      <title>Add a WhatsApp Chat Button to Any Website (No Plugin, No jQuery)</title>
      <dc:creator>Golam Rabbani</dc:creator>
      <pubDate>Mon, 09 Nov 2026 13:04:20 +0000</pubDate>
      <link>https://dev.to/golamrabbaninafiz/add-a-whatsapp-chat-button-to-any-website-no-plugin-no-jquery-1m9h</link>
      <guid>https://dev.to/golamrabbaninafiz/add-a-whatsapp-chat-button-to-any-website-no-plugin-no-jquery-1m9h</guid>
      <description>&lt;h1&gt;
  
  
  Add a WhatsApp Chat Button to Any Website (No Plugin, No jQuery)
&lt;/h1&gt;

&lt;p&gt;If your customers already live on WhatsApp, a chat button is the shortest path between "I have a question" and a sale. This post builds one from scratch, then looks honestly at where the simple version stops being enough.&lt;/p&gt;

&lt;h2&gt;
  
  
  The 2-minute version
&lt;/h2&gt;

&lt;p&gt;WhatsApp has an official click-to-chat URL:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://wa.me/15551234567?text=Hi!%20I%20have%20a%20question.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;wa.me/&amp;lt;phone&amp;gt;&lt;/code&gt; opens a chat with that number (international format, no &lt;code&gt;+&lt;/code&gt;, no spaces). The &lt;code&gt;text&lt;/code&gt; parameter pre-fills the visitor's message, URL-encoded.&lt;/p&gt;

&lt;p&gt;A floating button is just a fixed-position link:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"wa-btn"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://wa.me/15551234567?text=Hi!%20I%20have%20a%20question."&lt;/span&gt; &lt;span class="na"&gt;target=&lt;/span&gt;&lt;span class="s"&gt;"_blank"&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"noopener"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Chat on WhatsApp&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.wa-btn&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;fixed&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nl"&gt;right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nl"&gt;bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nl"&gt;z-index&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;9999&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;#25d366&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;#07332a&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;14px&lt;/span&gt; &lt;span class="m"&gt;18px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;999px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nl"&gt;font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;sans-serif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nl"&gt;text-decoration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;6px&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt; &lt;span class="nf"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;.25&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That works on any stack: plain HTML, WordPress, a React app, a Laravel template. If one person answers every chat and they are happy to be reachable at all hours, stop here. You are done.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the simple version breaks
&lt;/h2&gt;

&lt;p&gt;Real shops hit the same four walls:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;More than one agent.&lt;/strong&gt; Sales and support are different people. A single number sends every visitor to the same phone, and the wrong questions land with the wrong person.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The 2 a.m. message.&lt;/strong&gt; A visitor writes at night, gets silence, and buys elsewhere. The button should know working hours and say so honestly instead of pretending someone is there.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Every page asks the same question.&lt;/strong&gt; A visitor on a product page wants to ask about &lt;em&gt;that product&lt;/em&gt;. If the pre-filled message is generic ("Hi!"), half the conversation is spent finding out what they meant.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Checkout.&lt;/strong&gt; A floating chat button on the checkout page mostly distracts people who were about to pay. It should be possible to hide it there and only there.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What a proper widget needs
&lt;/h2&gt;

&lt;p&gt;Working through the list, a real widget needs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An &lt;strong&gt;agent picker&lt;/strong&gt;: tap the button, see the team, pick sales or support.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Working hours per agent&lt;/strong&gt;, with an online/offline state and an offline message when nobody is available.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A different pre-filled message per page&lt;/strong&gt;, with a sensible default for the rest of the site.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Page rules&lt;/strong&gt;: hide the widget on checkout, show it everywhere else.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero dependencies&lt;/strong&gt;, so it drops into any site as one snippet.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of this is hard, but it is a weekend of small details: time zones, day-of-week schedules, encoding the per-page messages, keeping the panel usable on a phone.&lt;/p&gt;

&lt;h2&gt;
  
  
  Full disclosure, and the shortcut
&lt;/h2&gt;

&lt;p&gt;I built exactly this as a small commercial widget, because I needed it to exist in vanilla JS with no server and no dashboard. You can try the live demo here:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://quiet-sprite-ca67a2.netlify.app/whatsapp-demo.html" rel="noopener noreferrer"&gt;Live demo on Netlify&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want the ready-made version instead of building your own, it is here (this is my product, and the link is my referral link):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.codester.com/items/74781/multi-agent-whatsapp-chat-widget?ref=golamrabbaninafiz" rel="noopener noreferrer"&gt;Multi-Agent WhatsApp Chat Widget on Codester&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And if the 2-minute version above is all you need, use it with my blessing. For a one-person shop it is genuinely enough.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Questions or a wall I missed? Tell me in the comments. I read all of them.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
