EmailAlertsOnWhatsapp
About
This repository contains the code which fetches recent mails from a user's gmail account and send it to his/her Whatsapp account using Twilio environment
Prerequistics
App Passwords
You can read more about it here
Setup
- Create Twilio Account and connect your whatsapp number to it (It's free)
- Go through the guide they provide and connect your whatsapp number such that you can send a message to the number and receive a message(Initially it would be something along the lines of "You send ")
- Navigate to the function page through the navigation bar at the left
- Create a new function (with any name you like) and copy the code in there.
- Inside the functions page, go to settings->Dependencies and make sure you have all the dependencies added as shown in the figure
- Now go to settings->Environment Variables and then set emailID as your GMail id and passKey as your App Password(If you don't know about app passwords please read the pre-requistic paragraph above)
- Save and select Deploy all
- Select the 'Copy URL' present just below the code editor to copy the link of the function after deploying.
- Now go to Programmable Messages->Settings->Whatsapp Sandbox Settings and paste the copied URL in step 8 into the 'WHEN A MESSAGE COMES IN' field in Sandbox Configuration
- Save and you are good to go
Features/Working
The chatbot searches for keywords and replies accordingly. The followinf keyword are currently implemented.
- Help : This gets the list of all keyword
- mail/email : This gets the recent 5 emails
- mail/email + unseen : This gets the latest 5 unseen emails
- Hello/Hey : This just greets you and asks if you want to get mails. If you type es then it fetches the mails.
Future Plans
- Add more functionalities/options with the email type being queried
- Using some algorithm/AI to predict what the user is asking and reply accordingly. Currently it is hardcoded.
- Add more features apart from email fetching (like weather, film reviews/recommendations) and turn it into a whatsapp assistant.