Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
wa-chat-widget
Advanced tools
A lightweight, customizable WhatsApp chat widget that adds a floating WhatsApp button to your website. When clicked, it opens a WhatsApp chat with a pre-defined message.
npm install wa-chat-widget
<script src="https://cdn.jsdelivr.net/npm/wa-chat-widget@1.0.3/dist/wa-chat-widget.js"></script>
or
<script src="https://unpkg.com/wa-chat-widget@1.0.3/dist/wa-chat-widget.js"></script>
Note: The Phone number should be entered in the international format without the
+
sign. For eg: If your number is +1 234-567-9898, then you should enter the phone number as12345679898
.
import WaChatWidget from 'wa-chat-widget';
const widget = new WaChatWidget({
phoneNumber: '1234567890',
message: "Hello! I'm interested in your services"
});
<script src="https://cdn.jsdelivr.net/npm/wa-chat-widget@1.0.3/dist/wa-chat-widget.js"></script>
<script>
const widget = new WaChatWidget({
phoneNumber: '1234567890',
message: "Hello! I'm interested in your services"
});
</script>
Option | Type | Default | Description |
---|---|---|---|
phoneNumber | string | '' | WhatsApp number in international format without + symbol in front (required) |
message | string | "I'm interested to know more about your offerings." | Default message |
position | string | 'bottom-right' | Widget position ('top-left' , 'top-right' , 'bottom-left' , 'bottom-right' ) |
backgroundColor | string | '#25D366' | Background color of the widget |
textColor | string | '#fff' | Color of the WhatsApp icon |
size | string | '60px' | Size of the widget |
showTooltip | boolean | true | Show/hide tooltip on hover |
tooltipText | string | 'Chat with us' | Text to show in tooltip |
new WaChatWidget({
phoneNumber: '1234567890'
});
new WaChatWidget({
phoneNumber: '1234567890',
backgroundColor: '#075e54',
textColor: '#ffffff',
size: '70px',
position: 'top-right'
});
const userLanguage = navigator.language.substring(0, 2);
const messages = {
en: "Hi, I'd like to know more",
es: "Hola, me gustaría saber más",
fr: "Bonjour, j'aimerais en savoir plus"
};
new WaChatWidget({
phoneNumber: '1234567890',
message: messages[userLanguage] || messages.en,
tooltipText: 'Chat with us'
});
const widget = new WaChatWidget({
phoneNumber: '1234567890'
});
// Hide widget
widget.hide();
// Show widget
widget.show();
// Update options
widget.updateOptions({
backgroundColor: '#128C7E',
size: '65px'
});
// Destroy widget
widget.destroy();
function isBusinessHours() {
const now = new Date();
const hours = now.getHours();
const day = now.getDay();
return day >= 1 && day <= 5 && hours >= 9 && hours < 17;
}
new WaChatWidget({
phoneNumber: '1234567890',
message: isBusinessHours()
? "Hi, I'd like to speak with your team"
: "Hi, I'd like to leave a message",
tooltipText: isBusinessHours()
? "Chat with us now!"
: "Leave us a message",
backgroundColor: isBusinessHours() ? '#25D366' : '#128C7E'
});
Method | Description |
---|---|
show() | Shows the widget |
hide() | Hides the widget |
destroy() | Removes the widget from DOM |
updateOptions(options) | Updates widget configuration |
If you want to use this plugin to develop commercial sites, themes, projects, and applications, the Commercial license is the appropriate license. With this option, your source code is kept proprietary. Read more about the commercial license.
If you are creating an open source application under a license compatible with the GNU GPL license v3, you may use this project under the terms of the GPLv3.
Raghu Chinnannan
For support, please open an issue in the GitHub repository.
FAQs
A simple WhatsApp chat widget for websites
The npm package wa-chat-widget receives a total of 5 weekly downloads. As such, wa-chat-widget popularity was classified as not popular.
We found that wa-chat-widget demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.