Sends new emails to a discord webhook using Gmail API
- Install Node.js and packages
npm i fs readline googleapis js-base64 axios
- Create a discord webhook and paste it on lines 118 and 141 of the script
- Create Credentials follow steps to Create Desktop application credentials and get
credentials.json
- Run the server
node email.js
- You can change the refresh rate at the bottom of the script (line 158). It's set to 60 seconds.
- Email body is trimmed to 1800 characters to meet discord's character limit
- Email attachments are ignored
- You can include the actual email address the message was sent from by deleting line 99
- You can change the name and profile picture of your webhook in discord settings
- My code is based off Google's example
- Discord webhook format
- Discord webhook color codes