Skip to content

Kurs05/google-chat-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

image

Document Chat Bot

A Google Chat bot that allows you to create polls for domain users and track voting results.

Tech Stack

  • Python 3.11
  • Google Cloud Functions
  • Firestore (Cloud Firestore)
  • Gmail API
  • Google Chat API
  • Service accounts with OAuth and domain-wide delegation

Features of Document Chat Bot

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.

Functional Capabilities:

  • 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.


Installation and Setup

1. Clone the Project

git clone https://github.com/Kurs05/document-chat-bot.git
cd document-chat-bot

2. Project Structure

Make sure the project includes both requirements.txt and main.py. Without them, Cloud Function will throw an error.

image

3. Service Account Roles and Delegation

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.


4. Enabled APIs Required for Bot Functionality

In APIs & Services:

  • People API
  • Secret Manager API
  • Gmail API
  • Google Chat API

5. Connect the Secret

In Secret Manager

Create a secret named key_for_chat_service and upload your service account's JSON key there.


Bot Screenshots

  1. Poll creation
image
  1. Poll closure
image
  1. If results are also sent via DM or email
image
  1. Example of what users receive
image

About

google chat bot for sending files

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages