This workflow lets a Slack App have a proper conversation with ChatGPT, with a complete history. It can handle two types of input: either a DM, in which case it will immediately start chatting, or through a slash command, eg. /chat Hey Chatbot
. Both of these use the first webhook.
The second webhook is to reset the chat using a slash command, eg. /chat-reset
.
I use Redis to maintain state, but if you want it to scale you could swap it out for a proper database.