<?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: Mcdavid Obioha</title>
    <description>The latest articles on DEV Community by Mcdavid Obioha (@mcdavidobioha).</description>
    <link>https://dev.to/mcdavidobioha</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%2F2050899%2F076721be-bc24-43e1-b52b-f5c508b46d0a.png</url>
      <title>DEV Community: Mcdavid Obioha</title>
      <link>https://dev.to/mcdavidobioha</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mcdavidobioha"/>
    <language>en</language>
    <item>
      <title>I built a zero-dependency, form-first WhatsApp widget for React &amp; plain HTML (with optional BYO-AI, live chat, and lead capture)</title>
      <dc:creator>Mcdavid Obioha</dc:creator>
      <pubDate>Wed, 02 Dec 2026 15:50:51 +0000</pubDate>
      <link>https://dev.to/mcdavidobioha/i-built-a-zero-dependency-form-first-whatsapp-widget-for-react-plain-html-with-optional-byo-ai-2b7j</link>
      <guid>https://dev.to/mcdavidobioha/i-built-a-zero-dependency-form-first-whatsapp-widget-for-react-plain-html-with-optional-byo-ai-2b7j</guid>
      <description>&lt;p&gt;Most WhatsApp widgets on npm are just a floating icon that drops visitors into an empty chat box. Businesses end up with vague &lt;em&gt;"Hi"&lt;/em&gt; messages, zero context on what page the visitor was viewing, and no record of leads who clicked the button but closed WhatsApp before hitting send.&lt;/p&gt;

&lt;p&gt;I built &lt;strong&gt;&lt;a href="https://www.npmjs.com/package/whatsapp-chat-widget-react" rel="noopener noreferrer"&gt;whatsapp-chat-widget-react&lt;/a&gt;&lt;/strong&gt; (now at &lt;strong&gt;v0.8.0&lt;/strong&gt; and already crossing &lt;strong&gt;320+ weekly downloads&lt;/strong&gt; in its first few days!) to solve this with a &lt;strong&gt;form-first&lt;/strong&gt;, &lt;strong&gt;zero-dependency&lt;/strong&gt;, &lt;strong&gt;privacy-aware&lt;/strong&gt; architecture—plus a standalone &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag build for sites that don't use React.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgtxk5q6bf75ozhz49v3t.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgtxk5q6bf75ozhz49v3t.gif" alt="whatsapp-chat-widget-react demo: pick an agent, fill the form, polish the message with AI, and see the exact WhatsApp message" width="720" height="468"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 Try the &lt;a href="https://github.io" rel="noopener noreferrer"&gt;Interactive Live Playground&lt;/a&gt; | ⭐ &lt;a href="https://github.com/mcdavidobioha/whatsapp-chat-widget-react-typescript" rel="noopener noreferrer"&gt;GitHub Repository&lt;/a&gt; | 📦 &lt;a href="https://www.npmjs.com/package/whatsapp-chat-widget-react" rel="noopener noreferrer"&gt;npm Package&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  What Makes &lt;code&gt;whatsapp-chat-widget-react&lt;/code&gt; Different?
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Form-First Pre-Qualification (Zero Backend Required by Default)&lt;/strong&gt;&lt;br&gt;
Visitors fill out a clean, accessible contact form (Name, Subject, Message) and hand off a formatted draft straight to &lt;code&gt;https://wa.me...&lt;/code&gt;. No API key, server, or account required out of the box.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Privacy-Safe Page Context &amp;amp; UTM Attribution (&lt;code&gt;includePageContext&lt;/code&gt;)&lt;/strong&gt;&lt;br&gt;
Automatically appends the page title, URL, and UTM tags (&lt;code&gt;utm_source&lt;/code&gt;, &lt;code&gt;utm_medium&lt;/code&gt;, &lt;code&gt;utm_campaign&lt;/code&gt;)—while &lt;strong&gt;stripping query strings and URL hashes by default&lt;/strong&gt; so sensitive auth tokens in URLs never leak into chat logs. &lt;em&gt;(Tip: Click the playground link above and submit a test message to see the &lt;code&gt;utm_source=devto&lt;/code&gt; attribution in action!)&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Teams, Timezone Business Hours &amp;amp; Smart Defaults&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pass an &lt;code&gt;agents&lt;/code&gt; array for an accessible department picker (Sales, Support, Billing) with avatars or initials.&lt;/li&gt;
&lt;li&gt;Timezone-aware &lt;code&gt;businessHours&lt;/code&gt; built on native &lt;code&gt;Intl.DateTimeFormat&lt;/code&gt; (zero &lt;code&gt;moment&lt;/code&gt; or &lt;code&gt;dayjs&lt;/code&gt; bloat)—automatically preselecting the first online agent.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Optional Live In-Widget Chat &amp;amp; Webhook Transport (&lt;code&gt;v0.8.0&lt;/code&gt;)&lt;/strong&gt;&lt;br&gt;
Want visitors to stay on your site instead of leaving for the WhatsApp app? Switch &lt;code&gt;transport&lt;/code&gt; to live mode using &lt;code&gt;createWebhookTransport&lt;/code&gt; (&lt;code&gt;whatsapp-chat-widget-react/adapters&lt;/code&gt;) to connect &lt;strong&gt;n8n&lt;/strong&gt;, &lt;strong&gt;Make&lt;/strong&gt;, &lt;strong&gt;Zapier&lt;/strong&gt;, or a &lt;strong&gt;WhatsApp Cloud API&lt;/strong&gt; proxy—complete with &lt;code&gt;sessionStorage&lt;/code&gt; persistence, delivery statuses, retry handling, and a &lt;em&gt;"Continue on WhatsApp"&lt;/em&gt; escape hatch.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Bring-Your-Own-AI (&lt;code&gt;v0.8.0&lt;/code&gt; — Zero SDK Bloat)&lt;/strong&gt;&lt;br&gt;
Connect any &lt;code&gt;/v1/chat/completions&lt;/code&gt; endpoint (OpenAI, Claude via OpenRouter/LiteLLM, Cloudflare AI Gateway, Groq, Ollama) via &lt;code&gt;createOpenAICompatibleAI&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;"Polish with AI" button&lt;/strong&gt; inside the textarea (with instant Undo).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Auto-routing &amp;amp; FAQ deflection&lt;/strong&gt; (&lt;code&gt;routeAndTriage&lt;/code&gt;) that routes to the right agent or answers common questions in-widget.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Private by design:&lt;/strong&gt; Phone numbers are never sent in AI triage or webhook payloads, and everything fails open so visitors are never blocked.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Popup-Blocker Safe Lead Capture (&lt;code&gt;webhookUrl&lt;/code&gt;)&lt;/strong&gt;&lt;br&gt;
Fires non-blocking JSON lead payloads via &lt;code&gt;navigator.sendBeacon&lt;/code&gt; (with &lt;code&gt;fetch&lt;/code&gt; &lt;code&gt;keepalive&lt;/code&gt; fallback) right as the user submits. If an async AI or webhook step consumes the browser's click activation, the widget automatically renders an &lt;strong&gt;"Open WhatsApp"&lt;/strong&gt; button instead of getting swallowed by a popup blocker.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Programmatic Control (&lt;code&gt;useWhatsAppWidget()&lt;/code&gt;)&lt;/strong&gt;&lt;br&gt;
Trigger the widget from any pricing calculator, navbar CTA, or page button using &lt;code&gt;openWithDraft({ subject: 'Enterprise Plan', message: '...' })&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  Quick Start: React / TypeScript
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm install whatsapp-chat-widget-react
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;WhatsAppChat&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'whatsapp-chat-widget-react'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nc"&gt;App&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;WhatsAppChat&lt;/span&gt;
      &lt;span class="n"&gt;phoneNumber&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"+2348000000000"&lt;/span&gt;
      &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Support Team"&lt;/span&gt;
      &lt;span class="n"&gt;includePageContext&lt;/span&gt;
      &lt;span class="n"&gt;theme&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"auto"&lt;/span&gt;
    &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;)&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;h3&gt;
  
  
  Quick Start: Plain HTML / No-React (&lt;code&gt;dist/standalone.global.js&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;Using plain HTML, Webflow, Shopify, or Squarespace? Drop in the zero-dependency script tag via jsDelivr or unpkg (complete with Shadow DOM isolation and Subresource Integrity):&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;script&lt;/span&gt;
  &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"https://jsdelivr.net"&lt;/span&gt;
  &lt;span class="na"&gt;data-phone&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"+2348000000000"&lt;/span&gt;
  &lt;span class="na"&gt;data-title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Support Team"&lt;/span&gt;
  &lt;span class="na"&gt;data-include-context&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"true"&lt;/span&gt;
  &lt;span class="na"&gt;defer&lt;/span&gt;
&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Links &amp;amp; Docs
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Interactive Playground:&lt;/strong&gt; &lt;a href="https://mcdavidobioha.github.io/whatsapp-chat-widget-react-typescript" rel="noopener noreferrer"&gt;https://mcdavidobioha.github.io/whatsapp-chat-widget-react-typescript&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Repository:&lt;/strong&gt; &lt;a href="https://github.com/mcdavidobioha/whatsapp-chat-widget-react-typescript" rel="noopener noreferrer"&gt;https://github.com/mcdavidobioha/whatsapp-chat-widget-react-typescript&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Full Feature Breakdown:&lt;/strong&gt; &lt;a href="https://github.com/mcdavidobioha/whatsapp-chat-widget-react-typescript/blob/b4b95591d410004e9ee34cae1d8fd81110a3ffca/FEATURES.md" rel="noopener noreferrer"&gt;FEATURES.md&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;npm Package:&lt;/strong&gt; &lt;a href="https://www.npmjs.com/package/whatsapp-chat-widget-react" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/whatsapp-chat-widget-react&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Feedback, stars, issues, and PRs are welcome!&lt;/p&gt;

</description>
      <category>react</category>
      <category>typescript</category>
      <category>opensource</category>
      <category>whatsapp</category>
    </item>
  </channel>
</rss>
