Adding ChatGPT to Mattermost

Community Spotlight: Mattermost ChatGPT bot by Sebastian Müller

If you’re interested in integrating AI with Mattermost, then it’s very easy to get started with this recent community project from Sebastian Muller that connects ChatGPT to your Mattermost server.

You can use the repository to launch your own Mattermost ChatGPT bot in a Docker container. All you need is a bot token from Mattermost and your API key from OpenAI.

Clone the repository locally and add an override file for the Docker Compose with your own settings. Here’s an example configuration that even includes a self-hosted Mattermost to run alongside it. In order for it to work, you need to define MATTERMOST_URL, MATTERMOST_TOKEN, and OPENAI_API_KEY environment variables for the ChatGPT bot container. For example:

services:
  chatbot:
    container_name: chatgpt
    image: yguy/chatgpt-mattermost-bot:latest
    build: .
    restart: unless-stopped
    depends_on:
      - mattermost
    network_mode: host
    environment:
      MATTERMOST_URL: http://localhost:8065
      MATTERMOST_TOKEN: YOUR-TOKEN-HERE
      OPENAI_API_KEY: YOUR-KEY-HERE

For more detailed instructions, check out the guide in the repository. When you’re ready, bring your containers online with docker compose up.

Finally, add the ChatGPT bot to any team and channel where you want to use it. Now you can talk to ChatGPT by mentioning the bot directly (it defaults to the @chatgpt username) and it will respond in a thread to your post.

Want to see it in action? Join the Ask ChatGPT channel in our community server and try it out for yourself.

Do you have your own interesting Mattermost integration? I’d love to check it out. Join the Community server and message me (@andrew.zigler) to get in touch!

Andrew Zigler is a developer advocate at Mattermost and public speaker at the intersection of AI and open source technologies. After studying Classics at The University of Texas at Austin and later teaching English in Japan, he continues to champion career and technical education for his audience.