This tool listens for incoming emails in a specified Gmail account and sends notifications to a Discord channel when new emails are received. It's designed to be used with the Heroku platform and can be scheduled to check for new emails at regular intervals.
- Automatically listens for incoming Gmail messages and posts to Discord.
- Tracks processed messages to avoid duplicate notifications.
- Parses email timestamps correctly, including handling time zones and "(UTC)" format issues.
- Designed to work with Heroku's free tier, scheduled to run every 10 minutes.
- Google Cloud account with Gmail API enabled.
- Heroku account with a Python environment.
- A Discord Webhook URL to post the notifications to.
- Clone the repository:
- Set up Google Cloud:
- Create a Google Cloud project and enable the Gmail API.
- Download your credentials as
credentials.json
and place it in the project directory. - Run the authorization flow to generate the
token.json
file. - Set up Heroku:
- Create a new Heroku app:
- Deploy the app to Heroku:
- Add your Discord Webhook URL as a config variable in Heroku:
- Run the app:
- Schedule the script to run every 10 minutes using the Heroku Scheduler:
- Set up the job to run
python3 gmail_to_discord.py
every 10 minutes in the scheduler dashboard. - View Logs:
- To view logs and troubleshoot:
git clone https://github.com/yourusername/gmail-to-discord
heroku create
git push heroku master
heroku config:set DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/your_webhook_url
heroku addons:create scheduler:standard
heroku logs --tail --app your_app_name
- Ensure that your Google Cloud credentials and tokens are properly set up and stored securely.
This project is open-source and available under the MIT License.