how to send media with javascript to wehatsapp web?

Viewed 77

i'm trying to send MSG automatically with javascript to my contacts from whatsapp web. i figure out, how to send auto text.

now i'm trying to send auto text + img/video.

this is my code for text

function simulateMouseEvents(element, eventName) 
{ 
    var mouseEvent = document.createEvent('MouseEvents'); 
    mouseEvent.initEvent(eventName, true, true); 
    element.dispatchEvent(mouseEvent); 
} 

const targetname = ['Test1', 'Test2', 'Test3', 'Test4', 'Test5', 'Test6', 'Test7', 'Test8', 'Test9', 
'Test10', 'Test11', 'Test12', 'Test13', 'Test14',];

for (let i = 0; i < targetname.length; i++){
setTimeout(function myFunc() 
{ 
    simulateMouseEvents(document.querySelector('[title="' + targetname[i] + '"]'), 'mousedown');
    messageBox = document.querySelectorAll("[contenteditable='true']")[1]; 
    event = document.createEvent("UIEvents"); 
    messageBox.innerHTML = "Hello World 1" ; 
    event.initUIEvent("input", true, true, window, 1); 
    messageBox.dispatchEvent(event); 
    document.querySelector('span[data-icon="send"]').click();
}, i * 3000)
};
0 Answers
Related