Skip to content

asaddon/WhatsApp

 
 

Repository files navigation

WhatsApp Chat widget for websites

For Full Animation Preview see Demo: https://asaddon.github.io/WhatsApp/

Screenshot 2025-01-26 at 4 00 34 AM

Instructions

  • Download WhatsappChatBox.min.js from here.

  • Add the file to your header <script src="WhatsappChatBox.min.js"></script>

  • Or directly embed it via <script src="https://cdn.jsdelivr.net/gh/asaddon/WhatsApp@refs/heads/main/dist/WhatsAppChatBox.min.js)"></script>

  • Initiate with the configuration Configure with your settings

  new WAChatBox({
     link: "https://wa.me/123456789",
                        user: {
                            name: "My Company",
                            avatar: "https://randomuser.me/api/portraits/women/66.jpg",
                            status: "Typically replies within few hours!"
                        },
                        chat_name: "Sales", 
                        text: "Hey There 👋<br>Let's talk to get a Price Quote!",
                        tooltipText: "Hi, I am here to assist you!",
                        tooltipTimeout: 15000,
  });

Geo Restriction

You can restrict the widget to only show for visitors from specific countries, or hide it for visitors from certain countries, using ISO 3166-1 alpha-2 country codes.

Show only for certain countries (allowedCountries)

new WAChatBox({
  link: "https://wa.me/123456789",
  allowedCountries: ["US", "CA", "GB"], // Only show for USA, Canada, and UK
});

Hide for certain countries (blockedCountries)

new WAChatBox({
  link: "https://wa.me/123456789",
  blockedCountries: ["IN", "PK"], // Hide for India and Pakistan
});

Note: Country detection relies on the visitor's IP address via api.country.is. If the detection request fails for any reason, the widget will be shown by default.

About

A Simple Whatsapp Widget for your Website

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 59.1%
  • CSS 38.2%
  • HTML 2.7%