Coder Social home page Coder Social logo

gpt-slack's Introduction

GPT-Slack

A slack bot that proxies messages out to OpenAI's ChatGPT API.

Running

Deploy

A Dockerfile is provided to bundle up the application, if Heroku is not an option for you.

Configuration

To easily create the Slack app, use slack-manifest-template.yaml in the "create new apps" page on Slack. Make sure to update the event subscription URL once the gpt-slack application is deployed.

Environment variables:

  • SLACK_BOT_TOKEN: Obtain this (and the other slack variables) from the Slack Bolt JS getting started guide.
  • SLACK_SIGNING_SECRET
  • SLACK_APP_TOKEN: If an app token is provided, the application will run in "socket mode," and will not need to have an incoming request URL configured. Only set this value if you intend to run in socket mode. Attempting to do a webhook event subscription with this value set may fail.
  • OPENAI_API_KEY: Obtain this from OpenAI

Required Slack permissions:

  • app_mentions:read: Allow the bot to be invoked by an @-mention
  • chat:write: Allow the bot to write responses
  • channels:history: Allow the bot to read threads to provide context to ChatGPT
  • groups:history: Allow the bot to read threads to provide context to ChatGPT
  • im:history: Allow the bot to read threads to provide context to ChatGPT
  • mpim:history: Allow the bot to read threads to provide context to ChatGPT

Additional required setup:

  • Configure the Slack app's event request URL to be https://<deployed-app-url>/slack/events
  • Add an event subscription for app_mention to the bot app under "event subscriptions" in Slack's developer portal

Usage

In a Slack channel, write a message @-mentioning the bot.

@gptbot, implement hello world in Elixir

The bot will respond to the message in a thread with "Thinking…"

After there is a response from OpenAI, the "Thinking…" message will be replaced with the response.

System prompts

Any message containing [SYSTEM] will be interpreted as a system prompt, which is used to provide instructions to ChatGPT.

gpt-slack's People

Contributors

christianalexander avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.