Slack

The Slack Integration lets you to easily create Slack bots with natural language understanding based on Conversational Agents (Dialogflow CX) technology.

Limitations

Set Up Slack

In order to set up the Slack integration for your agent, you'll need the following:

  • A Slack account
  • A Slack workspace

Create a Slack bot

  1. Navigate to your Slack Apps
  2. Create a new slack app from an app manifest. Below is an example manifest. Make sure that the oath_config and event_subscriptions fields match with the example manifest.
    display_information:
      name: Conversational Agents (Dialogflow CX)
      description: Conversational Agents (Dialogflow CX) integration
      background_color: "#1148b8"
    features:
      app_home:
        home_tab_enabled: false
        messages_tab_enabled: true
        messages_tab_read_only_enabled: false
      bot_user:
        display_name: CX
        always_online: true
    oauth_config:
      scopes:
        bot:
          - app_mentions:read
          - chat:write
          - im:history
          - im:read
          - im:write
          - incoming-webhook
    settings:
      event_subscriptions:
        request_url: https://dialogflow-slack-4vnhuutqka-uc.a.run.app
        bot_events:
          - app_mention
          - message.im
      org_deploy_enabled: false
      socket_mode_enabled: false
      token_rotation_enabled: false
    
  3. Install your application into the workspace of your choice
    • Bot User OAuth Token
      • Navigate to Install App > OAuth Tokens for Your Workspace > Bot User OAuth Token
    • Signing Token
      • Navigate to Basic Information > App Credentials > Signing Secret

Set up Conversational Agents (Dialogflow CX)

  1. Click Manage tab on the left panel.
  2. Click Integrations in the left menu.
  3. Click the Connect button on the Slack tile.
  4. Fill in the following information:
    • Access token
    • Signing token
  5. Choose an environment, as applicable.
  6. Click Start.
  7. Copy the Webhook URL.

Enable webhook in Slack

Return to your Slack App and paste your webhook url under Event Subscriptions > Enable Events > Request URL

Testing

To test your configured app, in the workspace you installed it in, mention it in a group channel or send it a DM.

Rich response messages

The rich response messages are supported via Custom Payload in Fulfillment. Please see Slack message API for the message format.

For example, the following custom payload provides a simple Slack text message:

{
  "text": "Hello, world"
}

Channel specific responses

After you configure the channel-specific responses, the channel DF_CX_SLACK is automatically used when the agent responds to Slack messages.