I’m using VueJS.
I have created a Whatsapp business account, and I created a button in my site – whenever the user clicks on it, a new tab will be opened and he will be in a chat with my Whatsapp Business account.
I was able to do it, but the thing I couldn’t do – is that whenever the user just enters the chat (without sending a message), I want my Whatsapp business to automatically send him “Hello, how can I help you?”.
<template>
<button @click="openWhatsApp">Connect on WhatsApp</button>
</template>
<script>
export default {
methods: {
openWhatsApp() {
const companyPhoneNumber = "999999999";
const message = encodeURIComponent("Hello, how can I help you?");
const url = `https://wa.me/${companyPhoneNumber}`;
window.open(url, "_blank");
},
},
};
</script>