Start an API service for interacting with ChatGPT on Slack using the OpenAI node
Note: The code is ugly because I only want to make it works and too lazy to maintain
Sign up at https://platform.openai.com/overview and create a new API key in https://platform.openai.com/account/api-keys
Check this for the guide how to create a Slack App https://slack.dev/bolt-js/tutorial/getting-started
And you need these keys for the next step
SLACK_SIGNING_SECRET=""
SLACK_BOT_TOKEN=""
SLACK_APP_TOKEN=""
In OAuth & Permission, add these scopes to Bot Token Scopes
app_mentions:read
channels:join
chat:write
chat:write.customize
chat:write.public
im:history
im:read
im:write
Probably don't need all of them, but I'm too lazy to check, sorry
Require nodejs >= 18 (required by above lirary)
Create new .env
and update the information
cp .env.sample .env
# Open file `.env` and filling all the keys
Install
yarn install
Start the service
yarn start
@YourSlackBot <your question>
, you can mention it in the thread to continue the conversationYou can send a message @YourSlackBot summary
to get the summary of the current thread