Skip to content

Latest commit

 

History

History
84 lines (58 loc) · 2.9 KB

SETUP.md

File metadata and controls

84 lines (58 loc) · 2.9 KB

Set up in Slack

  1. Set up your Slack Platform account (full instructions @ https://api.slack.com/future/quickstart)
curl -fsSL https://downloads.slack-edge.com/slack-cli/install.sh | bash
  • Authorize your CLI to interact with Slack on your workspace with by running this command on your terminal and follow the prompts
slack login
  • Take the last line from your terminal (e.g. /slackauthticket ABC123defABC123defABC123defABC123defXYZ and paste that in your Slack message bar for your workspace)

Pasting in /slackauthticket ABC123defABC123defABC123defABC123defXYZ

  1. Fork the repo
git clone [email protected]:fxchen/SlackGPT
  1. Get an OpenAI API key (https://beta.openai.com/account/api-keys). Make sure to add billing information.

instructions-open-ai

You can test your token validity with this command that executes a completion on "hello world"

TOKEN=YOUR_TOKEN_HERE
completion_openai() {curl -X POST https://api.openai.com/v1/completions -H 'Content-Type: application/json' -H "Authorization: Bearer $TOKEN" -d "{  \"model\": \"text-davinci-003\",  \"prompt\": \"$1\",  \"n\": 1}" | tr -d '\n' | jq '.choices[0].text'}
completion_openai "hello world"
  1. Save this secret. Create a new file in your SlackGPT folder called .env. Replace the string in this env file with your actual OpenAI token. Details: https://beta.openai.com/docs/api-reference/introduction
openai_token = "YOUR_TOKEN_HERE"

Alternatively, use this command at the root directory to add this secret at run time.

slack env add openai_token "YOUR_TOKEN_HERE"
  1. Deploy the SlackGPT application

Run the command slack deploy

  1. Get channel ids for your bot to watch for by clicking the channel name in Slack. In this screenshot, I have a channel called #hello-slackgpt. Details: https://api.slack.com/future/apicalls/third-party

Instructions for grabbing a channel's channel-id

  1. Set up your bot to watch for mentions!
  • Open triggers/gpt_mentioned_trigger.ts
  • Update channel_ids to include channels where you want SlackGPT to respond to
  • Run the command below
slack trigger create --trigger-def "triggers/gpt_mentioned_trigger.ts"
  1. 🎉 Use ChatGPT through a Slack interface

Saying hello world to @SlackGPT