A Python-based tool to monitor Google Drive and send notifications to Discord using Google APIs and a Discord webhook.
- Monitor Google Drive for changes like new files or updates.
- Notify a Discord channel via webhook with detailed information.
- Easily deployable through GitHub Actions.
-
Google Service Account:
- Create a Google Service Account via the Google Cloud Console.
- Share access to the monitored Google Drive folder with the service account email.
- Download the service account JSON file.
-
Enable Google Drive API:
- Visit the Google Drive API page.
- Enable the API for your project.
-
Discord Webhook:
- Create a webhook in your desired Discord channel. Learn more here.
-
Required Variables:
DISCORD_WEBHOOK_URL
: Discord webhook URL.SERVICE_ACCOUNT_JSON_BASE64
: Base64-encoded string of your service account JSON.
To encode your service account JSON:
- Visit Base64 Encode.
- Upload or paste your JSON file's content.
- Copy the encoded string and use it as the value for the
SERVICE_ACCOUNT_JSON_BASE64
variable.
-
Add Environment Variables to GitHub Secrets:
- Navigate to your forked repository on GitHub.
- Go to Settings > Secrets and variables > Actions > New repository secret.
- Add the following secrets:
DISCORD_WEBHOOK_URL
: Paste your Discord webhook URL.SERVICE_ACCOUNT_JSON_BASE64
: Paste the Base64-encoded JSON string.
-
Fork the repository:
- Click the "Fork" button at the top right corner of this GitHub repository.
-
Enable GitHub Actions:
- Go to the "Actions" tab in your forked repository.
- Enable workflows to automatically run the script.
-
Adjust the folder ID in the configuration file:
- Open
config.json
. - Update the
"folder_id"
field with the Google Drive folder ID you want to monitor.
Example:
{ "folder_id": "your_google_drive_folder_id" }
- Open