This is a Javascript Project which will fetch all the mail notifications and send it to WhatsApp.
Load the respective code in your code editor and run it on your local host.
Framework => Express, EJS, Node JS.
Backend Language => Javascript.
FrontEnd => EJS.
Software Used for Sending and Receiving messages from WhatsApp => Twilio WhatsApp Sandbox.
Go to Twilio Console, Create a new account and check out functionality to Send and Receive messages from Whatsapp.
Use the link to see trail.
Check out for your personal twilio whatsapp mobile number. Save the Twilio Mobile Number and send your respective code to activate the Twilio SandBox.
Start your WhatsApp service using Twilio.
Checkout for your AuthToken and AuthId and put it in .env file.
For receiving messages from WhatsApp, Do the following
- Download ngrok from https://ngrok.com/download
- run ngrok htpp 5000 //Your port Number
- Wil see a screen like this
Copy the Forwarding link (till io) and Paste it in Twilio console at https://console.twilio.com/us1/develop/sms/settings/whatsapp-sandbox?frameUrl=%2Fconsole%2Fsms%2Fwhatsapp%2Fsandbox%3Fx-target-region%3Dus1
Paste it like this link https://136e-2405-201-5507-a80b-6928-503f-77db-56b1.ngrok.io/whatsapp
By saving all the credentials, you can receive message from WhatsApp and respond Accordingly.
If you donot make ngrok server to run, you will not receive messages from WhatsApp.
SetUp you GMAIL For Creating Imap connection
- On your computer, open Gmail.
- In the top right, click Settings .
- Click Settings.
- Click the Forwarding and POP/IMAP tab.
- In the “IMAP access” section, select Enable IMAP.
- Click Save Changes
NOTE: In Gmail Settings make your gmail account TURN ON for Less Secure Apps. (Otherwise you will get Error)
You can use the following links to go through the code and learn more about it.
https://excellencetechnologies.in/blog/receive-and-send-email-from-email-server-with-node-js/
https://dev.to/mesadhan/manage-your-re-mail-using-imap-2p18
https://www.codegrepper.com/code-examples/javascript/read+email+using+node+js
https://www.zeolearn.com/magazine/sending-and-receiving-emails-using-nodejs
- Run your Application on Localhost
- Fill your Credentials accordingly and Submit it.
NOTE : Please Enter your Mobile Number with Country Code as in below Pic.
- On submitting your Credentials, you will get a message on your Submitted WhatsApp Number
It will take some time, but if the message doesnot come, you have entered wrong mobile number or in wrong format
- On writing the keyword CHECK, it will fetch all unread/ unseen mails from your respective mail id.
NOTE : On writing the wrong Email Credentials, you will get a message for Invalid Credentials.
UPDATES ARE ALWAYS WELCOMED
You can add more new features to retreive whole message and reply the mail from whatsapp too.