Telex Google Drive Notifier is a TypeScript Node.js application that monitors changes in a specified Google Drive folder and sends real-time notifications to the Telex App via webhooks. It detects file uploads, modifications, and deletions in real-time, ensuring that users stay updated with any changes in their Google Drive folders.
β
Real-time monitoring of Google Drive folder changes
β
Instant notifications to Telex App via webhooks
β
TypeScript for enhanced type safety and developer experience
β
Google Drive API v3 integration for reliable change detection
β
Redis for configuration persistence and caching
β
Express.js server with comprehensive error handling
β
Jest testing framework with TypeScript support
β
ESLint & Prettier for code quality and formatting
β
Systemd service support for VPS deployment
β
CI/CD pipeline with GitHub Actions
- Runtime: Node.js v18+
- Language: TypeScript 5.3+
- Framework: Express.js 4.21+
- Database: Redis 4.7+
- API: Google Drive API v3
- Testing: Jest 29+ with ts-jest
- Build Tool: TypeScript Compiler (tsc)
- Code Quality: ESLint 9+ & Prettier 3+
git clone https://github.com/na-cho-dev/telex-gdrive-notifier.git
cd telex-gdrive-notifier
npm install
Create a .env
file in the project root:
PORT=3300
GOOGLE_SERVICE_ACCOUNT_PATH=./config/service-account.json
GOOGLE_DRIVE_WEBHOOK_TOKEN='your-webhook-token-here'
TELEX_ENV='dev'
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
DEV_WEBHOOK_URL='https://your-dev-webhook-url.com'
- Get your Google Service Account JSON file by following this guide
- Save the file as
service-account.json
in the./config/
directory - Ensure the service account has Google Drive API access
# On Ubuntu/Debian
sudo systemctl start redis-server
# Or run directly
redis-server
# Build TypeScript to JavaScript
npm run build
# Start the application
npm start
For development:
# Run with hot-reload using tsx
npm run dev
Ensure Redis is running:
redis-server
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Generate coverage report
npm run test:coverage
GET /integration.json
Returns the Telex integration configuration
POST /tick
Registers webhook and starts monitoring Google Drive folder
Request Body:
{
"channel_id": "your-channel-id",
"return_url": "https://your-telex-webhook-url.com",
"settings": [
{
"label": "Folder ID",
"type": "text",
"required": true,
"default": "your-google-drive-folder-id"
}
]
}
POST /gdrive-webhook
Receives notifications from Google Drive API when folder changes occur
GET /
Returns server status and welcome message
# Clean build
npm run prebuild # Removes dist folder
npm run build # Compiles TypeScript
# Code quality
npm run lint # Run ESLint
npm run lint:fix # Fix ESLint issues
npm run format # Format code with Prettier
# Development
npm run dev # Start with hot-reload
- Build the application:
npm run build
- Start with PM2 (recommended):
npm install -g pm2
pm2 start dist/server.js --name telex-gdrive-notifier
pm2 save
pm2 startup
- Create service file:
sudo nano /etc/systemd/system/telex-gdrive-notifier.service
- Add configuration:
[Unit]
Description=Telex GDrive Notifier
After=network.target redis.service
[Service]
Type=simple
User=root
WorkingDirectory=/root/telex-gdrive-notifier
ExecStart=/usr/bin/node dist/server.js
Restart=always
RestartSec=10
Environment=NODE_ENV=production
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target
- Enable and start:
sudo systemctl daemon-reload
sudo systemctl enable telex-gdrive-notifier
sudo systemctl start telex-gdrive-notifier
- Check status:
sudo systemctl status telex-gdrive-notifier
journalctl -u telex-gdrive-notifier -f
The repository includes a CI/CD pipeline that automatically deploys to DigitalOcean when you push to the main
branch. Configure these secrets in your GitHub repository:
DO_SSH_PRIVATE_KEY
: Your DigitalOcean server SSH private keyDO_SSH_USER
: SSH username (usuallyroot
)DO_SERVER_IP
: Your server's IP address
telex-gdrive-notifier/
βββ src/
β βββ controllers/ # Request handlers
β β βββ gdriveWebhookController.ts
β β βββ jsonIntegrationController.ts
β β βββ telexWebhookController.ts
β βββ database/ # Database connections
β β βββ redisClient.ts
β β βββ redisSubscriber.ts
β βββ routers/ # Route definitions
β β βββ jsonIntegrationRouter.ts
β β βββ webhookRouter.ts
β βββ service/ # Business logic
β β βββ checkIfNoChanges.ts
β β βββ dataStore.ts
β β βββ googleDriveService.ts
β β βββ sendNotification.ts
β β βββ startDriveWatch.ts
β βββ types/ # TypeScript type definitions
β β βββ index.ts
β βββ server.ts # Application entry point
βββ __tests__/ # Test files
βββ dist/ # Compiled JavaScript (generated)
βββ config/ # Configuration files
βββ docs/ # Documentation and screenshots
βββ .github/workflows/ # GitHub Actions CI/CD
βββ eslint.config.ts # ESLint configuration
βββ jest.config.ts # Jest testing configuration
βββ babel.config.ts # Babel configuration
βββ tsconfig.json # TypeScript configuration
βββ package.json # Dependencies and scripts
-
Add Integration URL in your Telex organization:
https://your-domain.com/integration.json
-
Configure Settings:
- Folder ID: The Google Drive folder ID you want to monitor
- Interval: Set to
* * * * *
(every minute) for real-time monitoring
-
Get Google Drive Folder ID:
- Open Google Drive and navigate to your target folder
- Copy the folder ID from the URL:
https://drive.google.com/drive/folders/1AbCdEfGhIjKlMnOpQrStUvWxYz
- The folder ID is:
1AbCdEfGhIjKlMnOpQrStUvWxYz
All requests are automatically logged in the format:
[2025-02-23T12:34:56.789Z] - [GET /integration.json HTTP/1.1] - 200 OK (25ms)
# Check Redis status
redis-cli ping
# Monitor Redis commands
redis-cli monitor
# Clear all data (if needed)
redis-cli FLUSHALL
# With systemd
journalctl -u telex-gdrive-notifier -f
# With PM2
pm2 logs telex-gdrive-notifier
-
"Cannot read properties of undefined (reading 'Router')"
- Ensure all dependencies are installed:
npm install
- Rebuild the project:
npm run build
- Ensure all dependencies are installed:
-
Redis connection errors
- Check if Redis is running:
systemctl status redis-server
- Verify Redis configuration in
.env
- Check if Redis is running:
-
Google Drive API errors
- Verify service account JSON file exists in
./config/
- Ensure service account has Drive API permissions
- Check Google Drive API quotas
- Verify service account JSON file exists in
-
TypeScript compilation errors
- Run:
npx tsc --noEmit
to check for type errors - Ensure all TypeScript dependencies are installed
- Run:
The application is deployed at: https://telexgdrivenotifier.live
This project is licensed under the MIT License - see the LICENSE file for details.
- Developer: Fortune Iheanacho
- Email: nachodev369@gmail.com
- GitHub: @na-cho-dev
- Fork the repository
- Create your feature branch:
git checkout -b feature/amazing-feature
- Commit your changes:
git commit -m 'Add amazing feature'
- Push to the branch:
git push origin feature/amazing-feature
- Open a Pull Request
If this project helped you, please consider giving it a β on GitHub!