DEV Community

Md.ismail
Md.ismail

Posted on

How to Integrate Hermes AI with Slack: A Step-by-Step Guide

Integrating Hermes with Slack turns your AI agent into a 24/7 command center, allowing you to message it, automate workflows, and receive notifications directly in your workspace.

Follow these steps to set it up:

Step 1: Generate the Slack App Manifest

Instead of configuring Scopes and Socket Mode manually in the Slack UI, you can let Hermes generate an App Manifest for you.

  1. Open your terminal and run the following command to generate the manifest file:
hermes slack manifest --write
Enter fullscreen mode Exit fullscreen mode
  1. This creates a file containing all required permissions, event subscriptions, and Socket Mode settings optimized for Hermes. Open and copy the contents of this file.

Step 2: Create the Slack App

  1. Go to the Slack API Apps Dashboard and click Create New App.
  2. Select From an app manifest.
  3. Choose your target workspace, paste the generated manifest code, and click Create.

Step 3: Install and Get Your Tokens

  1. Go to the OAuth & Permissions page in the left sidebar and click Install to Workspace. Authorize the app.
  2. Once installed, copy the Bot User OAuth Token (starts with xoxb-).
  3. Go to the Basic Information tab and copy the Signing Secret.
  4. Go to the Socket Mode tab, generate an App-Level Token (starts with xapp-), and copy it.

Step 4: Configure Hermes

  1. Open your Hermes configuration file:
nano ~/.hermes/config.yaml
Enter fullscreen mode Exit fullscreen mode
  1. Add your Slack tokens to the config.yaml file:
slack:
  botToken: "xoxb-YOUR_BOT_TOKEN_HERE"
  appToken: "xapp-YOUR_APP_TOKEN_HERE"
  signingSecret: "YOUR_SIGNING_SECRET_HERE"
Enter fullscreen mode Exit fullscreen mode

Step 5: Start the Gateway

  1. Run the setup wizard in your terminal:
hermes gateway setup
Enter fullscreen mode Exit fullscreen mode
  1. Select Slack (use your spacebar to select and enter to confirm).
  2. Paste the requested tokens when prompted.
  3. Start the gateway by running:
hermes gateway run
Enter fullscreen mode Exit fullscreen mode

Step 6: Authorize Your Slack User ID

Hermes restricts access by default for security.

  1. Message your newly created bot in Slack (e.g., say @Hermes hello).
  2. Because you aren't authorized yet, the terminal logs will print an error reading: gateway run unauthorized user along with your specific Slack user ID.
  3. Copy that user ID from the logs and authorize yourself in Hermes by running:
hermes config set Slack allowed_users [YOUR_USER_ID]
Enter fullscreen mode Exit fullscreen mode

Step 7: Test the Bot

Restart the Hermes gateway. You can now chat directly with your Hermes AI agent in Slack!

Top comments (0)