Skip to content

Integrating with a Slack bot (on-prem)

Learn how to configure CalypsoAI as a chatbot in your Slack environment using our on-premises deployment option. This tutorial walks you through the complete process of creating, configuring, and deploying your CalypsoAI Slack bot.

PREREQUISITES

You must have an active CalypsoAI Inference Defend subscription, and be an administrator user of your organization's Slack environment.

Create a bot project

A bot project is a fundamental component for your Slack integration. For the purpose of this tutorial, we will use the project to configure some basic settings and generate the necessary credentials.

To create a bot project:

  1. Log in to CalypsoAI.
  2. From the menu, select Projects.
  3. In the Quick project setup section, select the Bot (Slack or Microsoft Teams) option, and then select Create.
  4. In the popup, complete the basic configuration for your bot:
    • In Bot name, enter the name for your bot.
    • From the available models list, choose the AI model you want to use for your bot.
    • From the Assign project admins list, select one or more administrator users to manage your bot configuration.
  5. Select Create.
    CalypsoAI displays confirmation that the bot with the default scanners enabled was created and is connected to the chosen AI model.
  6. In the next popup, select Generate API key.
    CalypsoAI generates and assigns an API token for your bot project.

    STORING THE TOKEN

    Make sure you store the token securely, as it is required to complete the configuration in Slack.

  7. Select Next.
  8. In the next popup, select the Slack option, and then select Next.

Your CalypsoAI bot project is created and ready to be added to Slack.

Create the CalypsoAI Slack app

After creating the bot project, you need to create the CalypsoAI Slack app.

To create the CalypsoAI Slack app:

  1. On your desktop, open a terminal window and enter the following command:
    console
    curl - H "Authorization: Bearer ${CALYPSOAI_TOKEN}"
    "${CALYPSOAI_URL}/backend/v1/bots/slack/manifest" > manifest.json
    • Replace the CALYPSOAI_TOKEN string with the API token you created in Create a bot project.
    • Replace the CALYPSOAI_URL string with the actual base URL of your backend.
  2. Run the command.
    The manifest.json file is created.
  3. Go to https://api.slack.com/apps/.
  4. Select Create an App.
    Create Slack app

    CREATING AN APP

    If there are other apps already listed on the page, Create an App is not present. Instead, select Create New App.

  5. Select From a manifest.
  6. Select the workspace to which you want to add your bot.
  7. Select Next.
  8. Select JSON.
  9. Copy and paste the contents of the manifest.json file into the text box.
  10. Select Next.
    A summary of the app is displayed.
  11. Select Create.

The CalypsoAI Slack app is created.

Configure the CalypsoAI deployment server

Next, you need to configure your CalypsoAI deployment server.

To configure your CalypsoAI deployment server:

  1. On the machine you are using to deploy the server, set the following environment variables:
    • CAI_MODERATOR_SLACK_CLIENT_ID = "ENTER-YOUR-APP-CLIENT-ID-HERE"
    • CAI_MODERATOR_SLACK_CLIENT_SECRET = "ENTER-YOUR-CLIENT-SECRET-HERE"
    • CAI_MODERATOR_SLACK_SIGNING_SECRET = "ENTER-YOUR-SIGNING-SECRET-HERE"

    ENVIRONMENT VARIABLE CREDENTIALS

    To find your app credentials:

    1. Go to https://api.slack.com/apps/.
    2. Select your app.
      The Basic Information menu is displayed. You can find the required credentials in the App Credentials section.
      Slack app credentials
  2. Restart the deployment server.

With the CalypsoAI deployment server restarted, you can add the CalypsoAI app to Slack.

Add the CalypsoAI bot app to Slack

Now that you created the CalypsoAI app and configured your deployment server, you need to add the app to your Slack environment.

To add the CalypsoAI app to Slack:

  1. From the Slack main menu, select Apps > Manage > Browse apps.
  2. In the search box, enter CalypsoAI.
  3. For the CalypsoAI app, select Install.

The app is installed and ready for configuration.

Configure the CalypsoAI bot app in Slack

Establish the connection between your Slack environment and the CalypsoAI bot, enabling secure communication and functionality.

To configure the CalypsoAI bot app:

  1. From the Slack main menu, in Apps, select CalypsoAI. Open CalypsoAI app
  2. In the message text box, enter and send the /configure command.
  3. In the response box from CalypsoAI, enter the API token you created for the CalypsoAI bot project, and then select Submit.
    Slack API token submission

After the token is accepted, your Slack integration is complete and you can start interacting with the CalypsoAI bot through the message text box:

  • To list the AI models available in the chat, enter and send /models.
  • To start a new chat with the default model, enter and send /chat <YOUR-MESSAGE>.
    For example: /chat What is the capital of Peru?.
  • To start a new chat with a specific model, enter and send /chat-with <MODEL-NAME>.
    For example: /chat-with gpt-4.

ABOUT TAB

You can select the About tab to view app permissions and see a list of available commands.
Slack About tab

Finalize the integration

Finalize the integration process by configuring the bot project's scanners, providers, and users in the CalypsoAI web app.

To finalize the integration:

  1. Log in to CalypsoAI.
  2. From the menu, select Projects.
  3. Select your bot project.
  4. Configure your bot project.

Your Slack integration is now complete!

Updated at: