Skip to content

tretton37/sales-aid-slack-bot

Repository files navigation

Sales Aid Slack Bot

Sales Aid Slack Bot is a Slack bot designed to assist with sales tasks. It leverages the Slack API and other services to provide useful functionalities.

Table of Contents

Initialization

Create an app at: https://api.slack.com/apps
Create an API key: https://app.cinode.com/tretton37/account

Don't forget to install the app on slack and invite the bot to the channel you want it to listen to. Sales Aid Slack Bot is a Slack bot designed to assist with sales tasks. It leverages the Slack API and other services to provide useful functionalities.

Enable or disable Socket Mode depending on how the bot is running.

Enable events under 'Event Subscriptions' in Slack app admin.

Installation

  1. Install the dependencies:
    npm install

Configuration

  1. Copy the .env.example file to .env:

    cp .env.example .env
  2. Fill in the environment variables in the .env file:

    SLACK_APP_TOKEN: Under *Basic Information*, Create an App level token with the connections:write scope
    SLACK_BOT_TOKEN: Under *Install App*, Bot User OAuth Token
    SLACK_SIGNING_SECRET: Under *Basic Information*, Client Secret
    CINODE_ACCESS_ID: Create an Cinode API key under *My  Account*, Access Id
    CINODE_ACCESS_SECRET: Create an API key under *My  Account*, Access Secret

Usage

  1. Start the application:

    npm start
  2. The bot will start running and listen for events on the specified port (default is 3000).

Deploy

The bot is deployed to Google Cloud using the docker container.

  1. Make sure you have Docker installed.

  2. Install the Google Cloud CLI.

  3. Create a Google Cloud project (either through portal or CLI)

  4. Add some environmental variables

    PROJECT_ID=$(gcloud config get-value core/project)
    REGION="europe-north1" // Or whatever region you want
  5. Log in to your google cloud via the CLI and make sure you have the correct services

    gcloud auth login
    gcloud config set project $PROJECT_ID
    gcloud services enable artifactregistry.googleapis.com
    gcloud services enable run.googleapis.com
  6. Athenticate docker to use your google auth

    gcloud auth configure-docker
  7. Build the image.

    docker build -t gcr.io/$PROJECT_ID/slack-bolt-app .
  8. Push the image to Google Container Registry

    docker push gcr.io/$PROJECT_ID/slack-bolt-app
  9. Deploy the Google Run Function

    gcloud run deploy slack-bolt-app \
    --image gcr.io/$PROJECT_ID/slack-bolt-app \
    --platform managed \
    --region $REGION \
    --allow-unauthenticated \
    --set-env-vars PROJECT_ID=$PROJECT_ID
  10. See output for your google run URL. Go to api.slack.com and go to your app and go down to Event Subscription and paste in your new link and add /slack/events to the end as that is the endpoint that Bolt uses.

Dependencies

License

This project is licensed under the ISC License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published