This is a lightweight automation tool(like Zapier) built with Go that handles form submissions and distributes the data to:
- PostgreSQL database
- Telegram bot notifications
- Google Sheets integration
It supports Google OAuth2 for Google Sheets access, uses Gin for the HTTP server, and makes use of Go's concurrency features to initialize services in the background.
- Multi-channel Distribution: Form data is simultaneously sent to a database, Telegram, and Google Sheets
- Concurrent Processing: Leverages Go's goroutines for efficient handling of requests
- OAuth Integration: Secure Google Sheets API authentication
- RESTful API: Simple endpoints for form submission and service status
- Real-time Notifications: Instant Telegram alerts for new form submissions
This application uses:
- Gin Web Framework for HTTP routing
- Telegram Bot API for notifications
- Google Sheets API for spreadsheet integration
- PostgreSQL for persistent data storage
- Concurrency with goroutines for improved performance
- Go 1.18+
- PostgreSQL database
- Telegram Bot Token
- Google Cloud Platform credentials for Sheets API
-
Clone the repository:
git clone https://github.com/yourusername/form-automation-tool.git cd form-automation-tool -
Install dependencies:
go mod download
-
Create
.env.localfile with necessary environment variables:DB_URL=postgres://username:password@localhost:5432/dbname TG_BOT_TOKEN=your_telegram_bot_token -
Add your Google OAuth credentials file as
web.jsonin the project root directory.
-
Start the server:
go run main.go
-
On first run, follow the OAuth authorization link displayed in the console to authorize Google Sheets access.
-
Send form data to the application:
curl -X POST http://localhost:8080/SendForm \ -d "name=John Doe" \ -d "gmail=john@example.com" \ -d "description=This is a test message"
-
Check application status:
curl http://localhost:8080/status
- Start a chat with your bot
- Send any message to the bot to establish the admin chat ID
- The bot will automatically use this chat for notifications
- PostgreSQL: Configure connection string via the
DB_URLenvironment variable - Telegram: Set your bot token via the
TG_BOT_TOKENenvironment variable - Google Sheets:
- Create OAuth credentials in the Google Cloud Console
- Download and save as
web.jsonin the project root - Set the target spreadsheet ID in the code.