Skip to Content

Deploy an SAP Conversational AI Chatbot on Slack

test
0 %
Deploy an SAP Conversational AI Chatbot on Slack
Details

Deploy an SAP Conversational AI Chatbot on Slack

July 28, 2020
Created by
July 28, 2020
Deploy an SAP Conversational AI chatbot on Slack and add it to a Slack channel to respond to user messages.

You will learn

  • How to deploy a chatbot to Slack
  • How to add app to channel
  • How to talk directly with the app without a channel

Prerequisites


Step 1: Connect with Slack
  1. Go to the Connect tab.

    Connect tab
  2. Under Third party integrations, click Slack.

    Open Slack

This will open a set of instructions for integrating with Slack, and a place to store tokens for connecting to Slack. But you can follow the instructions in this tutorial instead.

Log on to answer question
Step 2: Create a Slack app
  1. Go to https://api.slack.com/apps.

  2. Click Create App.

    Create app
  3. Enter the following:

    Field Name Value
    App Name Animal Facts
    Development Slack Workspace Select your workspace
  4. Click Create App.

    Your app is created.

    New app
Log on to answer question
Step 3: Get credentials
  1. In the Slack app page, in the Basic Information tab, scroll down to the App Credentials section.

    Link text e.g., Destination screen
  2. Copy the Client ID and Client Secret from the Slack app page to the Slack panel in the Connect tab in SAP Conversational AI:

    Link text e.g., Destination screen
  3. Click Get Tokens.

    This will create OAuth and Event URLs.

    Credentials results

    Hold onto to these URLs because you will need to enter them within your app on Slack.

Log on to answer question
Step 4: Set the OAuth redirect URL
  1. In the Slack app page, go to OAuth & Permissions.

  2. Click Add New Redirect URL.

    OAuth

    Enter the OAuth URL from SAP Conversational AI, click Add, then click Save URLs.

Log on to answer question
Step 5: Enable interactivity
  1. In the Slack app page, go to Interactivity & Shortcuts.

    Interactivity
  2. Turn interactivity On.

  3. Enter the events URL from SAP Conversational AI into the Request URL.

    Add request URL

    Click Save Changes.

Log on to answer question
Step 6: Add scopes
  1. In the Slack app page, go to OAuth & Permissions, and scroll down to Scopes.

    Scopes
  2. Click Add an OAuth Scope and add the following scopes:

    Scope
    app_mentions:read
    channels:history
    chat:write
    im:history
    users:read

    These give the app permission, for example, to read mentions entered into Slack or to post messages.

  3. Scroll to the top and click Install App to Workspace, and then click Allow to give your app the needed permissions.

Log on to answer question
Step 7: Subscribe to events
  1. In the Slack app page, go to Event Subscriptions.

    Events
  2. Turn events On.

  3. Enter the events URL from SAP Conversational AI into Request URL.

  4. Under Subscribe to bot events, and subscribe to events.

    Click Add Bot User Event and add the following events:

    Event
    app_mention
    message.im
    message.channels
  5. Click Save Changes.

Log on to answer question
Step 8: Add bot to workspace

In the Slack panel in the Connect tab in SAP Conversational AI, go to step 8 (Add my bot to a slack channel).

Authorize

Click the link.

Allow

Allow the permissions for the app by clicking Allow. You should get a success message.

Allow OK
Log on to answer question
Step 9: Talk to the app directly
  1. In Slack, scroll down to Apps, click + and add the app to your Slack.

    Add app
  2. Search for Animal Facts and select the app.

    Find app

    After selecting, the Animal Facts is added to your apps in the Slack navigation panel. It’s message screen is also displayed.

    App added
  3. Enter the word cat, and the bot responds by making an API call to get a fact about cats, and displays in the Messages panel.

    App test

    Cats can’t produce fat!?

Log on to answer question
Step 10: Talk to bot in channel

You can also add the app to a channel, so when someone specifically sends a message to the app, the bot processes the message and returns the appropriate response.

  1. Go to the channel and open the Details panel on the right.

    I created a private channel called Test.

  2. Click More > Add Apps, find your app, and to the right click Add.

    Add to channel
  3. Now you can speak to the bot via direct message.

    Test app in channel

    Did you know snails are closely related to oysters and clams?

Log on to answer question
Step 11: Test yourself
What event occurs when "a message is posted to a channel"?
×

Next Steps

Back to top