/slack-ai

Primary LanguagePython

Table of contents

Create Slack App

  1. Login to your Slack App here
  2. Create a new App here
  3. Choose From Scratch
  4. Give App Name: Slack-AI-Tool
  5. Pick up your workspace
  6. Create the App
  7. Go to OAuth & Permissions
  8. Go to Scopes
  9. Add an OAuth Scope: chat:write, channels:history, groups:history, mpim:history, im:history, users:read
  10. Scroll up to OAuth Token for Your Workspace and press Install to Workspace
  11. Copy the Bot User OAuth Token

Add the Slack App to your desired channel

  1. Go to Slack
  2. Pick a channel
  3. Go to Channel Settings
  4. Go to Integrations
  5. Add apps
  6. Add your Slack-AI-Tool

Google Service Account

Initialization

export service_account_name="slack-ai"
export role_name="slack_ai"
export project_id="<project_id>"
export title="Slack AI"

Create service account

gcloud iam service-accounts create $service_account_name --display-name "$service_account_name"

Create role

gcloud iam roles create $role_name \
    --project $project_id \
    --title "$title" \
    --description "This role has only the necessary permissions for DevOps AI tools" \
    --permissions aiplatform.endpoints.predict

Bind service account to role

gcloud projects add-iam-policy-binding $project_id --member 'serviceAccount:<Service Account ID>@$project_id.iam.gserviceaccount.com' --role='projects/$project_id/roles/$role_name'

Update the role

gcloud iam roles update $role_name --project=$project_id --permissions=bigquery.jobs.create,aiplatform.endpoints.predict

Describe the role

gcloud iam roles describe --project=$project_id $role_name

Create Json key for the service account

gcloud iam service-accounts keys create $role_name \
    --iam-account=<Service Account ID>@$project_id.iam.gserviceaccount.com

Build up the Docker image

docker build --platform linux/amd64 -t naturalett/slack-ai:slack-ai-v1 .

Reference

  1. Link 1