For Full Animation Preview see Demo: https://asaddon.github.io/WhatsApp/
-
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,
});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.
new WAChatBox({
link: "https://wa.me/123456789",
allowedCountries: ["US", "CA", "GB"], // Only show for USA, Canada, and UK
});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.
