A Basic HTTP Server for Tracking Sentiment of Text Data.
Website: https://tone-track.uno
Cross-platform mobile application: Tone Track
Email: [email protected]
Service Tone Track is a heavyweight HTTP server designed to track the sentiment of text data.
Leveraging the power of the NLTK and Transformers libraries, this service provides a straightforward way to analyze the sentiment of any given text.
- sentiment analysis service: Accurately determines the sentiment (positive, negative, neutral) of the input text.
- flutter app: A Mobile app that integrates with this service to provide sentiment analysis and handle user diary entries.
- slack app: The Slack App that integrates with this service to provide sentiment analysis for Slack messages.
- web interface: A simple web interface that allows users to interact with the sentiment analysis service.
Models supported only english language for now:
- VADER: A rule-based sentiment analysis tool that is specifically attuned to sentiments expressed in social media.
- BERT: A transformer model that is fine-tuned to perform sentiment analysis on text data.
Tone Track - A diary application that analyzes entries based on sentiment analysis, helping users track and understand their emotional states over time.
To install the required dependencies, run the following commands:
chmod +x ./generate_env.sh;
./generate_env.sh;
docker compose --file user-setup.yml up -d
When the server is up and running, you can access the API at localhost:80
Replace <YOUR API KEY FROM .env FILE volume>
with the API key from the .env
file in the root directory.
curl --location 'http://0:80/api/v1/sentiment-analysis' \
--header 'Content-Type: application/json' \
--header 'Authorization: <YOUR API KEY FROM .env FILE volume>' \
--data '{"text": "Your hard work is noticed, and it brings results!", "sentiment_type": "vader"}'
A successful response will look like this:
{"text":"Your hard work is noticed, and it brings results!","sentiment_result":"negative"}
To integrate the Slack App with the service, you need to create a Slack App and install it on your workspace.
- Create a new Slack App here and select from scratch.
- Navigate to the
OAuth & Permissions
section and add the following scopes:
Bot Token Scopes:
chat:write
chat:write.public
channels:read
commands
User Token Scopes:
channels:history
Install the app to your workspace by Install to Workspace
button.
- Add the following environment variables to the
.env
file in the root directory:
SLACK_SIGNING_SECRET
- your Slack App's signing secret from theBasic Information
section.SLACK_BOT_OAUTH_TOKEN
- your Slack App's bot token from theOAuth & Permissions
section.
- Run the following command to expose the local server to the internet:
Ngrok is required to expose the local server to the internet.
Required environment variable:
NGROK_AUTHTOKEN
- your Ngrok auth token from here
docker run --net=host -it -e NGROK_AUTHTOKEN=YOUR_NGROK_AUTH_TOKEN ngrok/ngrok:latest http 80
- Navigate to the
Interactivity & Shortcuts
section of the Slack and add the following request URL:
Replace YOUR_NGROK_SUBDOMAIN
with your Ngrok subdomain.
Example: https://0154-95-160-47-60.ngrok-free.app/api/v1/slack/interactions
https://YOUR_NGROK_SUBDOMAIN.ngrok-free.app/api/v1/slack/interactions
- Navigate to the
Enable Events
section and add the following request URL:
Replace YOUR_NGROK_SUBDOMAIN
with your Ngrok subdomain.
https://YOUR_NGROK_SUBDOMAIN.ngrok.io/api/v1/slack/events
Note: trouble with save button, look at the Slack Forum for more information.
- Navigate to the
Slash Commands
section and create a new commands:
Replace YOUR_NGROK_SUBDOMAIN
with your Ngrok subdomain.
I: Add | Update sentiment analysis message to channel
- Command: /tt-add-message
- Request URL: https://YOUR_NGROK_SUBDOMAIN.ngrok.io/api/v1/slack/commands
- Short Description: Add | Update sentiment analysis message to channel
Replace YOUR_NGROK_SUBDOMAIN
with your Ngrok subdomain.
II: Retrieve sentiment analysis message from channel
- Command: /tt-read-message
- Request URL: https://YOUR_NGROK_SUBDOMAIN.ngrok.io/api/v1/slack/commands
- Short Description: Retrieve sentiment analysis message from channel
Well done! You have successfully integrated the Slack App with service.
You can now test the app by sending negative message in channel and bot identifies the sentiment and reply to you.
To deploy the service to Kubernetes cluster, you can use the Helm chart provided in the devops/helm directory.
For detailed instructions, refer to the Helm README.
Alternatively, if you are using Docker Compose, you can deploy the service using the user-setup.yml file provided in the root directory.
SSL certificate are required to configure the Slack App. You can generate them using this guide and modify user-setup.yml and nginx files.
Don't forget to update configuration settings by new URL in the Slack App settings after deployment.
This project is licensed under the Apache License - see the LICENSE file for details.
If you found this project helpful or you learned something from the source code and want to thank me, please supporting this Charity