2021-03-04 19:00:00 +01:00
|
|
|
<!doctype html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
2021-06-28 11:51:13 +02:00
|
|
|
|
|
|
|
<script>
|
|
|
|
var script = document.createElement('script');
|
|
|
|
script.setAttribute('src', document.referrer + 'iframe_api.js');
|
|
|
|
script.defer = false;
|
|
|
|
script.async = false;
|
|
|
|
document.head.appendChild(script);
|
|
|
|
</script>
|
2021-03-04 19:00:00 +01:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<button id="sendchat">Send chat message</button>
|
|
|
|
<script>
|
|
|
|
document.getElementById('sendchat').onclick = () => {
|
2021-06-28 11:51:13 +02:00
|
|
|
WA.chat.sendChatMessage('Hello world!', 'Mr ROBOT');
|
2021-03-04 19:00:00 +01:00
|
|
|
}
|
|
|
|
</script>
|
2021-03-06 15:26:07 +01:00
|
|
|
<div id="chatSent"></div>
|
|
|
|
<script>
|
2021-06-28 11:51:13 +02:00
|
|
|
window.addEventListener('load', () => {
|
|
|
|
WA.chat.onChatMessage((message => {
|
|
|
|
const chatDiv = document.createElement('p');
|
|
|
|
chatDiv.innerText = message;
|
|
|
|
document.getElementById('chatSent').append(chatDiv);
|
|
|
|
}));
|
|
|
|
})
|
2021-05-12 14:30:12 +02:00
|
|
|
</script>
|
2021-03-04 19:00:00 +01:00
|
|
|
</body>
|
|
|
|
</html>
|