Slack

The Slack Integration lets you create Slack bots with natural language understanding based on Dialogflow CX technology.

Limitations

Set Up Slack

To set up the Slack integration for your agent, you need the following:

  • A Slack account.
  • A Slack workspace.

Create a Slack bot

  1. Go to your Slack Apps.
  2. Create a new Slack app from an app manifest. The following is an example manifest. Make sure that the oauth_config and event_subscriptions fields match with the example manifest:

    display_information:
      name: Dialogflow CX
      description: 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 app into the workspace of your choice:

    • Bot User OAuth Token: Go to Install App > OAuth Tokens for Your Workspace > Bot User OAuth Token.
    • Signing Token: Go to Basic Information > App Credentials > Signing Secret.

Set up Dialogflow CX

  1. Go to the Manage tab on the navigation menu.
  2. Select Integrations.
  3. Click the Connect button on the Slack tile.
  4. Provide the following information:
    • Access token
    • Signing token
  5. Select an environment, as applicable.
  6. Click Start.
  7. Copy the Webhook URL.

Enable webhook in Slack

Go to Slack Apps and paste your Webhook URL under Event Subscriptions > Enable Events > Request URL.

Testing

To test your configured app in your workspace, mention it in a group channel or send a direct message.

Rich response messages

Rich response messages are supported using Custom Payload in Fulfillment. For more information, see the Slack message API for the message format.

For example, the following custom payload provides a 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.