Skip to content

Instantly share code, notes, and snippets.

@kevinresol
Created January 28, 2018 15:38
Show Gist options
  • Save kevinresol/f5253d148d5a37201b3e53f2b4fa70b2 to your computer and use it in GitHub Desktop.
Save kevinresol/f5253d148d5a37201b3e53f2b4fa70b2 to your computer and use it in GitHub Desktop.
Automate message sending in active chat for Whatsapp Web
function send(message) {
var input = document.querySelector('div.pluggable-input-body.copyable-text.selectable-text');
input.innerText = message;
input.dispatchEvent(new InputEvent('input', {
inputType: 'insertText',
data: message,
bubbles: true,
cancelable: false,
composed: true,
detail: 0,
}));
document.querySelector('button.compose-btn-send').click();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment