FeedbackTracker is a Slack bot that logs feedback messages from Slack channels into a Google Sheets document. This project is built using Flask, Google Sheets API, and Slack API.
- Listens for feedback messages in Slack channels.
- Logs feedback messages along with the user's name, email, and timestamp into a Google Sheets document.
- Python 3.9+
- A Google Cloud Platform project with Google Sheets API enabled.
- A Slack workspace with a Slack app that has the necessary permissions.
-
Create a Project in Google Cloud Console:
- Go to the Google Cloud Console.
- Create a new project.
-
Enable Google Sheets API:
- In the Google Cloud Console, go to the API & Services Dashboard.
- Click on "Enable APIs and Services."
- Search for "Google Sheets API" and enable it.
-
Create Credentials:
- Go to "Credentials" in the API & Services section.
- Click "Create Credentials" and select "Service Account."
- Fill in the required information and create the service account.
- After creating the service account, create a key for it (preferably JSON).
-
Share Your Google Sheet with the Service Account:
- Open your Google Sheet.
- Click "Share" and add the email address of your service account (found in the JSON file) with edit access.
-
Create a Slack App:
- Go to the Slack API dashboard.
- Create a new app.
-
Add Bot Scopes:
- Go to "OAuth & Permissions" and add the following scopes:
channels:history
chat:write
app_mentions:read
users:read
users:read.email
- Go to "OAuth & Permissions" and add the following scopes:
-
Enable Event Subscriptions:
- Go to "Event Subscriptions."
- Enable events and set the Request URL to
http://<your-server-ip>:5000/slack/events
. - Subscribe to the following bot events:
app_mention
message.channels
-
Install the App:
- Install the app to your Slack workspace and copy the OAuth token.
-
Clone the Repository:
git clone https://github.com/your-username/FeedbackTracker.git cd FeedbackTracker
-
Create a Virtual Environment:
python3 -m venv venv source venv/bin/activate
-
Install Dependencies:
pip install -r requirements.txt
-
Set Up Environment Variables: Create a
.env
file in the project root and add the following variables:SLACK_BOT_TOKEN=xoxb-your-slack-bot-token SPREADSHEET_ID=your-google-sheets-id SERVICE_ACCOUNT_FILE=path/to/your/service-account-file.json
-
Start the Flask Application:
gunicorn --bind 0.0.0.0:5000 app:app
-
Use ngrok for HTTPS (if needed):
ngrok http 5000
- Mention the bot in any Slack channel with your feedback.
- The bot will log the feedback, along with your name, email, and the timestamp, into the specified Google Sheets document.
@FeedbackTrackerBot I love UGC!
Date Time | User Name | Feedback |
---|---|---|
2024-07-15 08:56:20 | Abhijoy Sarkar [email protected] | I love UGC! |
Contributions are welcome! Please create a pull request with your changes.
This project is licensed under the MIT License - see the LICENSE file for details.