Okalmadyk Gmail habarlaryňyzy attachment lar bilen göni Discord-a iberiň! Python esasly bu programma, gelýän habarlary diňlemek etmek üçin Gmail API ulanýar we webhooks ulanyp, görkezilen Discord kanalyna iberýär.
- Real-time email notifications on Discord.
- Attachment forwarding.
- Filtered to only send unread emails.
Google Cloud Platform (GCP) setup with:
- Gmail API enabled.
- Consent screen created with Gmail scopes.
- OAuth2 credentials.
- Pub/Sub enabled.
- Python (3.7 or newer)
GCP Gmail API: The Gmail API lets the application fetch Gmail mailbox data.
Google Pub/Sub: It's a messaging service that allows real-time messaging.
Topic: A named resource to which messages are sent by publishers.
Subscription: A named resource representing the stream of messages from a single, specific topic.
Flask Webhook: Our server listens for incoming messages from GCP and processes them accordingly.
Google Cloud Platform: Follow the instructions in this guide to set up your GCP account and enable the necessary services.
Local Setup:
- Install necessary Python packages:
pip install google-auth google-auth-oauthlib google-auth-httplib2 google-api-python-client
pip install flask flask-admin flask-cors
pip install firebase firebase-admin
pip install discord
pip install requests BeautifulSoup4
- Update the configurations:
- Add your GCP creds.json
- Update the webhook_url variable with your Discord webhook in flask_config.py
- Update the topic_name variable with your GCP Topic Name in watch_setup.py
- Run the python file watch_setup.py to start listening to the inbox
python watch_setup.py
- Run the python file app.py to start the webhook
python watch_setup.py
Once set up, the application will:
Authorize: Use OAuth2 to authorize and access Gmail data.
Watch: It will start watching for unread messages in the mailbox.
Notify: On receiving a new unread email, it sends the content, including attachments, to the specified Discord channel.
Feel free to fork this project, open issues, or submit PRs. All contributions are welcome!