A Google Chat bot that allows you to create polls for domain users and track voting results.
- Python 3.11
- Google Cloud Functions
- Firestore (Cloud Firestore)
- Gmail API
- Google Chat API
- Service accounts with OAuth and domain-wide delegation
Document Chat Bot is a corporate Google Chat bot designed to create internal domain polls with storage and processing of results in Firestore. It simplifies collecting feedback and automates user interaction via Google Chat and Gmail.
-
Create polls via Google Chat commands
The bot supports a clear syntax to create polls with predefined answer options. -
Real-time vote handling and information updates
The bot tracks user choices and updates data as users vote. -
Store and manage results in Firestore
All poll data, including participant lists and their answers, is stored in Firestore. -
Notifications via Gmail API
If needed, the bot can send poll results to poll creators by email. -
Operates using a service account with domain-wide delegation
This allows acting on behalf of a user without requiring manual authorization. -
Integration with Secret Manager
All sensitive data (like keys and settings) can be stored securely.
git clone https://github.com/Kurs05/document-chat-bot.git
cd document-chat-botMake sure the project includes both requirements.txt and main.py. Without them, Cloud Function will throw an error.
Assign the following roles (OAuth scopes) to the service account used by the bot:
["https://www.googleapis.com/auth/chat.bot",
"https://www.googleapis.com/auth/chat.messages.create",
"https://www.googleapis.com/auth/gmail.send",
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/contacts.readonly"]Also, domain-wide delegation must be enabled. Without it, the bot will not function.
- People API
- Secret Manager API
- Gmail API
- Google Chat API
Create a secret named key_for_chat_service and upload your service account's JSON key there.
- Poll creation
- Poll closure
- If results are also sent via DM or email
- Example of what users receive