Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/freightcognition/mcp-slack-bot
A self-hosted Slackbot that performs Carrier Risk Assessments using the MyCarrierPortal API. Developed by FreightCognition, and open-source.
https://github.com/freightcognition/mcp-slack-bot
3pl freight logistics opensource slack truckload
Last synced: 19 days ago
JSON representation
A self-hosted Slackbot that performs Carrier Risk Assessments using the MyCarrierPortal API. Developed by FreightCognition, and open-source.
- Host: GitHub
- URL: https://github.com/freightcognition/mcp-slack-bot
- Owner: FreightCognition
- License: other
- Created: 2024-07-08T07:33:10.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2024-08-28T10:38:17.000Z (4 months ago)
- Last Synced: 2024-10-25T02:38:25.800Z (2 months ago)
- Topics: 3pl, freight, logistics, opensource, slack, truckload
- Language: JavaScript
- Homepage: https://freightcognition.io
- Size: 9.6 MB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MyCarrierPortal Risk Assessment Slackbot
### _by FreightCognition_A hostable Slack bot that integrates with the MyCarrierPackets API to provide risk assessments for motor carriers. Users can query the bot with an MC number to receive a detailed risk assessment report directly in Slack.
## Features
- Fetches carrier data from the MyCarrierPackets API
- Calculates risk levels and points for various categories (Authority, Insurance, Safety, Operation, Other, MyCarrierProtect)
- Displays a human-readable list of infractions with details
- Provides a summary of the overall risk assessment
- Report is viewable by entire channel in public channels, inside or outside your network.
- Works in private channels## Prerequisites
- MyCarrierPortal Subscription Subscription
- MyCarrierPortal Beraer Token via Postman test
- Slack Subscription (free)
- A server to host it on (AWS, Azure, Google Cloud, or your own.)
- _If you are not interested in hosting this yourself, reach out to me via this repo or Reddit and we can work something out._## Deploying on Google Cloud
To deploy this application on Google Cloud, follow these steps:
1. **Set up a Google Cloud Project**
- Go to the [Google Cloud Console](https://console.cloud.google.com/)
- Create a new project or select an existing one2. **Enable required APIs**
- Enable the Cloud Run API
- Enable the Secret Manager API3. **Set up Secret Manager**
- In the Google Cloud Console, go to Security > Secret Manager
- Create a new secret named `BEARER_TOKEN`
- Add your bearer token value to this secret4. **Prepare your application**
- Ensure your `package.json` file includes all necessary dependencies
- Create a `Dockerfile` in your project root:```dockerfile
FROM node:14
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
CMD [ "node", "app.js" ]
```5. **Deploy to Cloud Run**
- Open Google Cloud Shell or install and configure the [gcloud CLI](https://cloud.google.com/sdk/docs/install) on your local machine
- Build and deploy your container:```bash
gcloud builds submit --tag gcr.io/PROJECT_ID/mcp-slack-bot
gcloud run deploy mcp-slack-bot --image gcr.io/PROJECT_ID/mcp-slack-bot --platform managed --allow-unauthenticated
```Replace `PROJECT_ID` with your Google Cloud project ID.
6. **Set up environment variables**
- In the Cloud Run service details, go to the "Variables & Secrets" tab
- Add the following environment variable:
- Name: `GOOGLE_APPLICATION_CREDENTIALS`
- Value: `/etc/secrets/google-application-credentials.json`7. **Mount the service account key**
- In the same "Variables & Secrets" tab, under "Secrets", click "Add Secret"
- Choose the service account key file
- Mount path: `/etc/secrets/google-application-credentials.json`8. **Update Slack with your new endpoint**
- Copy the URL provided by Cloud Run after deployment
- Update your Slack app's slash command configuration with this new URLYour application should now be deployed and accessible via the Cloud Run URL. Make sure to test the integration to ensure everything is working correctly.
Contributing
Contributions are welcome! For bugs or improvement suggestions, please open an issue or submit a pull request.![image](https://github.com/user-attachments/assets/b2f2f1f4-8d22-4b47-9680-92c9798acc18)