This guide assumes that you have already created an agent following the Creating your first agent locally guide.

Setup

  • Visit https://api.slack.com/ and click on the “Your apps” button on the nav bar.
  • Click on “Create New App” button:
    • Click on “From scratch” button
    • Name your bot whatever you want and select the appropriate workspace, then click on “Create App”
  • Navigate to the app dashboard -> “OAuth & Permissions” section:
    • Scroll down to “Scopes” and add the following scopes:
      • app_mentions:read
      • channels:history
      • chat:write
    • Take note of the “Bot User OAuth Token” on this page.
  • Navigate to the “Basic Information” section and take note of the “Verification Token”.
  • Navigate back to the agent view on AgentReach, and click on the “Manage” button next to the “Slack connection” option:
    • Paste the previously noted “Bot User OAuth Token” in the “Slack Bot Token” field.
    • Paste the previously noted “Verification Token” in the “Slack Verification Token” field.
    • Copy the “Slack Webhook URL” shown to you, and click on the save button.
  • Navigate back to the Slack app dashboard, and click on the “Event Subscriptions” section:
    • Toggle the “Enable events” button to enable it.
    • Paste the “Slack Webhook URL” in the “Request URL” field, and wait for it to get verified.
    • Navigate to the “Subscribe to bot events” section and add the following events:
      • app_mention
      • message.channels
    • Click on the “Save Changes” button.

Conversational experience

  • Users on slack can tag your bot in any channel, followed by a message.
  • For example, if your both is called TestAgent, users, can send a message to it by typing @TestAgent hi. This will create a new session and call your agent webhook with this message.
  • Any output from your agent will be sent as a threaded message to the user’s initial message, so an entire session would look like this in the channel:
  • As you can see above, the session starts with a user message and contains 6 follow up messages.
  • Any new message sent to the bot in any channel via tagging it will create a new session for it.
  • If you tag the bot in an existing thread (which is not already a session for it), it will not create a new session for it, starting from that message.
  • Within a Slack thread that is a session for the bot:
    • Any message sent to the bot does not require tagging the bot.
    • If you send a message whilst the bot is not expecting it, it will be ignored.
    • If a session has ended and you send a message to the bot, it will be ignored.