Vorbly <Code>
CODING MADE EASY WITH VORBLY
WIX CODE WHATSAPP CLICK TO CHAT
Need a Whatsapp Live Chat on your website? This tutorial will show you how to implement Whatsapp Click To Chat using Wix Code. Help your customers, answer queries in real time and increase conversion rates. We will provide you with the webpage elements and sample codes required to implement this feature.
THE DEMO
THE ELEMENTS
The Page
Chat Button: #Chat
Chat Box (hide / collapse on load)
-
Box Element: #ChatBox
-
Text Element: #title
-
Text Input: #textBox1
-
Send Button: #Send
-
Minimize Button: #CloseChat
THE CODE
Page Code
// Send Message //
export function Send_click(event) {
let phone = "11231231234"; // Your Phone Number: Country Code + Number //
let text1 = $w("#textBox1").value;
let text2 = text1.replace(/\s/g, "%20");
let link = "https://wa.me/" + phone + "?text=" + text2;
$w("#Send").link = link;
}
// Open Chat Box //
export function Chat_click(event) {
$w("#ChatBox").show();
$w("#Chat").hide();
}
// Close Chat Box //
export function CloseChat_click(event) {
$w("#ChatBox").hide();
$w("#Chat").show();
}
COMMENTS
I'm a paragraph. Click here to add your own text and edit me. It's easy.