Slack

Slack is a web-based, real-time, and archived messaging app for your team. You can communicate in open or private channels, send direct messages to colleagues, and share files. This document describes how to connect IBM watsonx Orchestrate to Slack and use its skills on Orchestrate.

Before you begin

Before you connect Orchestrate to Slack, make sure that you have a Slack workspace. If you don't have a Slack account, you can create one and get started by creating a Slack workspace at Slack.

Save the workspace’s Slack URL, you need this data to connect Orchestrate to Slack.

Read more about Slack plans at Choose the plan that’s right for your team.

Connecting to Slack

Important: A credential type must be set for apps that are a part of team skill sets and AI assistants. Skill-based actions in AI assistants support only shared credentials.
If a credential type of an app is not specified, an error message is displayed when users attempt to run the skills of the app. To resolve the error, an admin must set the credential type for the app. For more information, see Managing connections.

An app can be connected either through the skill catalog or through the Orchestrate chat. Use the method that suits you to connect to an app.

Connect to the app through the skill catalog when you add that skill to your skill set:

  1. On the Orchestrate chat page, click Add skills from the catalog.
  2. Search and click the app tile.
  3. Click Connect app.
  4. Configure the connection. For more information, see Configuring the connection.
  5. Click Connect app.

Otherwise, connect to that app through the Orchestrate chat when you use the skill:

  1. Open the Orchestrate chat.
  2. On the chat, start the skill.
  3. Click Connect app.
  4. Configure the connection. For more information, see Configuring the connection.
  5. Click Connect app.

Configuring the connection on Orchestrate SaaS

To connect Orchestrate to Slack, click Connect app. It redirects you to sign in to a Slack workspace and permit Orchestrate to access that workspace. After you accept, Orchestrate connects to it automatically.

Note:
  • If you already have an active Slack connection in your browser, that connection is used for the authentication. Log out of the active connection to connect to a different Slack account.
  • The icon A green check icon appears to show that the app is connected. indicates that the connection was successfully established.

Configuring the connection on Orchestrate in IBM Cloud Pak for Data


To connect Orchestrate to Slack, complete the following steps:

  1. Click Connect app.
  2. In the Access token field, specify the access token to authenticate with your Slack account.
  3. Click Connect app.

For more information on how to get the connection values, see Getting the connection values.

Note: The icon A green check icon appears to show that the app is connected. indicates that the connection was successfully established.

Getting the connection values

Follow the steps to get the connection values to connect Orchestrate to Slack.

Access token

Step 1. Create a Slack app

  1. In your web browser, sign in to your Slack account.
  2. In the web browser, open the Your Apps page.
  3. If you don't have an app, create one to generate the access token.
    1. Click Create an App and choose the configuration for your app’s scopes and settings.
    2. Enter a name to identify your app, and select a workspace from the list.
    3. Click Create App.
  4. If you already have an app, from the Your Apps page, click the app that you want to generate the access token.

Step 2. Define the app's Redirect URL

  1. From the Features menu, click OAuth & Permissions.
  2. In the Redirect URLs section, click Add New Redirect URL.
  3. Enter the URL https://www.google.com, click Add, and then click Save URLs.

Step 3. Get the client ID and client secret

  1. From the Settings menu, click Basic information.
  2. In the App Credentials section, copy and save the values for Client ID and Client Secret.

Step 4. Authorize the app and get the authorization code

  1. Paste the following link in your browser's address bar. Replace <client_id> with the client ID from the step 3:

    https://slack.com/oauth/authorize?response_type=code&state=123456789&client_id=<client_id>&redirect_uri=https://www.google.com&access_type=offline&scope=identify,channels:read,users:read,users:read.email,chat:write:bot,im:read,mpim:read,files:write:user,files:read,groups:read,usergroups:read,chat:write:user,im:write,mpim:write,search:read
    
  2. If you see a page to authorize the app, click Allow.

  3. From the URL in the address bar, copy the value from the code query. For example, https://www.google.com/?code=<Code>&state=123456789.

Tip:The authorization code expires 10 minutes after you get it. After that time, you need to get a new code to proceed with the steps.

Step 5. Get the access token

  1. From the following cURL command, replace the values from <code>, <client_ID>, and <client_secret> with your own values obtained in the previous steps.

    curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=authorization_code&code=<code>&redirect_uri=https://www.google.com&client_id=<client_id>&client_secret=<client_secret>" https://slack.com/api/oauth.access
    
  2. Run the cURL command.

  3. In the response, get the value from the access_token key, for example:

    {
      "ok": true,
      "access_token": "xoxp-6982842894404-...-7116482670706-a18522f88...2dc66f482df133c",
      "scope": "identify,channels:read,files:read,groups:read,im:read,mpim:read,search:read,users:read,users:read.email,usergroups:read,chat:write:user,chat:write:bot,files:write:user,im:write,mpim:write",
      "user_id": "X000XXXX0X0",
      "team_id": "X000XXXX0X0",
      "enterprise_id": null,
      "team_name": "Example"
    }
    

Technical parameters

The following table contains the technical parameters that are required by some skills of this app, along with instructions on how to get these parameters.

Parameters Details
Text You can type in your message in the Text field.
OBJECT_ID

The Send a message skill requires the OBJECT_ID parameter that refers to the chat ID on Slack. To get the OBJECT_ID, complete the following steps:

  1. Open your Slack workspace and right-click the chat that you want to get the ID.
  2. Select View conversation details for conversation chat or View channel details for channel chat.
  3. Copy the Channel ID. If you don't see the Channel ID information, scroll through the chat details window. The Channel ID is at the bottom of the window.

When you refer to a Slack channel, the name of the channel with no accent might work, or you can use the Retrieve channels skill to get the channel ID.

parentType The type of the channel to post messages. Select any of the following channel types:
  • channel - To post the message to a public or private channel.
  • im - To post direct messages.
  • mpim- To post messages to multi-person direct messages of which you are a member.
memberID

To get the member ID, complete the following steps:

  1. Open your Slack workspace and then click the profile name or icon of the individual.
  2. Click View full profile.
  3. Click the menu Overflow menu and select Copy member ID to get the member ID of the individual.

Parse By default, the system removes the hyperlinks in your message by setting Parse to none. To hyperlink the URLs in your message, set Parse to full.
Unfurl links To enable the unfurling of text-based content, you can select the Unfurl links checkbox.
Unfurl media By default, links to media are unfurled. Select the Unfurl media checkbox to disable the unfurling of media content.
Icon URL URL of the image that you want to use as the profile photo alongside the message.
Icon emoji To use an emoji as the profile photo alongside the message, provide the value by using colon short codes. For example, use :white_check_mark: to set the emoji. Icon emoji value overrides the Icon URL and displays the specified emoji as the profile photo.
Thread timestamp To make your message a reply, you can provide the timestamp value of another message. The timestamp value enables the connection between the two messages and indicates that your message is in response to the one with the specified timestamp.
Reply broadcast Reply broadcast indicates whether your reply is to be made visible to everyone in the channel or conversation. By default, the value is set to false, which means that your reply is not broadcasted to all participants. However, you can select the checkbox to make your reply visible to everyone.

What to do next

After you connect to the app, you can use the app’s skills. For more information see, Using the chat. To know what skill you can use, see the skills and skill flow column of List of prebuilt apps, skills and skill flows.


Parent topic:

Prebuilt apps