Answer the question
In order to leave comments, you need to log in
How to send a WhatsApp message from a website using emoji (emoticons)?
The task is to send a text from the site to the specified WhatsApp number. The message was formed, sent to the specified number. Works.
However, when the user enters emoji characters, my code stops working. Tell me, is it possible to somehow encode / decode emoji characters to transfer them from the browser to the server? Or is it possible to somehow prevent emoji characters from being entered in the browser text field?
Code below:
<script src="https://unpkg.com/@green-api/whatsapp-api-client/lib/whatsapp-api-client.min.js"></script>
<script>
document.getElementById("SendWAMessage").addEventListener("click", function () {
try {
const restAPI = whatsAppClient.restAPI(({
idInstance: "8728",
apiTokenInstance: "87be28c803ecdf8b9ea1ff8c59d0cd146ed8836bc5c3437728"
}));
restAPI.message.sendMessage(null, document.getElementById("waPhone").value, document.getElementById("waMessage").value)
.then((data) => {
console.log(data);
}).catch((reason) =>{
console.error(reason);
});
} catch (reason) {
console.error(reason);
}
});
</script>
Answer the question
In order to leave comments, you need to log in
Or is it possible to somehow disable the input of characters?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question