Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save renielsalvador/b87af7e43bd03529edf4 to your computer and use it in GitHub Desktop.
Save renielsalvador/b87af7e43bd03529edf4 to your computer and use it in GitHub Desktop.
// hold chat list
var chatlist = document.getElementsByClassName('_55za');
for(var x=0; x<chatlist.length; x++) { // loop
// open chatbox by triggering click
chatlist[x].click();
// get message textarea
var messages = document.getElementsByClassName('_552m');
// set its value
messages[0].value = 'Happy new year! I hope this new year will bring good luck to you and your family and to all your friends. -CHEERS :D';
// declare new event
var e = new Event("keydown");
// keycode for Enter/Return key
e.keyCode = 13;
// trigger
messages[0].dispatchEvent(e);
var closeBtn = document.getElementsByClassName('_3olu');
// finally close the chat box
closeBtn[0].click();
}
@smsuresh
Copy link

how to test this!

@raysichic
Copy link

hello bro Plz how to test this script!

@renielsalvador
Copy link
Author

renielsalvador commented Jun 13, 2018

You can try to copy and paste it in your console.

@Kresys
Copy link

Kresys commented Oct 2, 2018

Hi ! On which Facebook page do you run the script ?

@KhushalGupta
Copy link

please tell the steps to run the script.

@SwapnilSoni1999
Copy link

class layouts are deprecated now.. no use of this script now

@GMYXDS
Copy link

GMYXDS commented Jul 21, 2020

It does not work

@Danie11111
Copy link

Everything can be done much easier. I use a software called cucomm. It automatically sends messages to users on Facebook. It saves time and is much more convenient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment