# Slack Integration- Using different methods

**URL:** <https://forum.uipath.com/t/slack-integration-using-different-methods/535439>\
**Category:** Vote on Tutorials\
**Tags:** uipath, other-products, faq, slack, slack-connector, studio, orchestrator, integration-service, activities\
**Created:** [April 13, 2023, 12:33pm UTC](https://forum.uipath.com/t/slack-integration-using-different-methods/535439 "2023-04-13T12:33:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Navya\_Haritha\_Vendra](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/navya_haritha_vendra/32/275110_2.png) [@Navya\_Haritha\_Vendra](https://forum.uipath.com/u/Navya_Haritha_Vendra)\
**Post date:** [April 13, 2023, 12:33pm UTC](https://forum.uipath.com/t/slack-integration-using-different-methods/535439/1 "2023-04-13T12:33:01Z")

</div>

Slack Integration using Incoming Webhooks, Access Token, Web API slack methods and integration services.

### **Pre-requisites:**

1. Requires Slack account and a workspace created in it. After that [Sign](https://slack.com/signin)into your Slack workspace or have the Slack desktop application open.
2. If you sign in using the URL above, you’ll need your [workspace Slack URL](https://get.slack.help/hc/en-us/articles/221769328-Locate-your-Slack-URL).
3. Go to [Your Apps](https://api.slack.com/apps) and click the **Create New App** button ( **Enterprise account** : Need’s admin permission for approval of your app).
4. Enter your **App Name** , select the **Development Slack Workspace** and click the **Create App** button.

### After you create your app, you’re taken to the **Basic Information** page. There are Different ways to authenticate.

#### 1. **Incoming webhooks (Unattended automation)**

- **From features** go to Incoming Webhooks and activate incoming webhooks.  
 ![image-20230202-142128](https://global.discourse-cdn.com/uipath/original/4X/c/b/e/cbeecf3811fbb448ae0cff36f26e1ac63ded037f.png)
- [Incoming webhooks](https://api.slack.com/messaging/webhooks) are a simple way to **post messages** from external sources into Slack. They make use of normal HTTP requests with a JSON payload, which includes the message and a few other optional details. You can include [message attachments](https://api.slack.com/docs/message-attachments) to display richly formatted messages.
- Adding incoming webhooks requires a bot user. If your app doesn’t have a [bot user](https://api.slack.com/apps/A04KVNKAP61/app-home), we’ll add one for you.
- Each time your app is installed, a new Webhook URL will be generated.
- If you **deactivate incoming webhooks** , new Webhook URLs will not be generated when your app is installed to your team. If you’d like to remove access to existing Webhook URLs, you will need to [Revoke All OAuth Tokens.](https://api.slack.com/apps/A04KVNKAP61/oauth?)
- To dispatch messages with your webhook URL, send your [message](https://api.slack.com/messages) in JSON as the body of an `application/json` POST request.
- Next add the new webhook to workspace (you can select channel, direct message etc.) and copy that webhook URL.
- Before making use of that webhook URL download the Web API package from the marketplace into the studio and drag & drop http request in that paste the URL in the end point section.

#### 2. **Web API slack methods (Unattended automation)**

Before using this, you should configure the **OAuth & Permissions** features by following the steps in the next section.

1. **Add Permissions:** Adding permissions to your app is done using [scopes](https://api.slack.com/docs/oauth-scopes). Scopes define the API methods this app can call and the information it can access in the workspace it’s installed on. Many scopes are restricted to specific resources like channels or files.
2. In the left-hand navigation, click the **OAuth & Permissions**.
3. In the **Scopes** section, add the permission scopes that you want to assign to your app and click the **Save Changes** button ([Scopes to add](https://docs.uipath.com/activities/docs/slack-setup#section-scopes-to-add))
4. Based on HTTP request token used roles must be configured i.e. it can be **bot or user OAuth token.**
5. After adding scope, click the **Install App to Workspace** button or **Request to Install** button.
6. After the app is installed, an **OAuth Access Token** is generated. Make use of that token based on bot or user.

#### **Note** : **To use admin scopes, you need paid version of slack.**

 ![image-20230202-142948](https://global.discourse-cdn.com/uipath/original/4X/3/6/1/361bb58d8133d02ac000352eec48a8a7bd84e758.png)  
**Next After configuring all the scope, now you can make use of all the web API slack methods using this** [**URL**](https://api.slack.com/methods)

#### Note: The same Web API methods can be implemented using _UiPath.Slack.Activities (v1.1.0) package_ in UiPath studio with **Invoke Slack Operation**  **activity.**

#### 3. **Access Token (Unattended automation)**

- In the **OAuth Tokens & Redirects URLs** section, click the **Install App to Workspace** button or **Request to Install** button.
- After the app is installed, an **OAuth Access Token** is generated. The **OAuth Access Token** is used for authentication purposes.
- Make use of that token in the **Slack Scope** activity

#### 4. **Integration Service (Unattended automation)**

- Select **Integration Service** from **Automation Cloud**.
- From the **Connectors** list, select **Slack**.  
You can also use the search bar to narrow down the connector.
- Select the **Add connection** button.
- Select **Connect**.
- You are now redirected to Slack sign in page. Enter your workspace URL and select **Continue**.
- If you’re a member of the workspace, select **Sign in with SSO**. If you’re a guest, select **I have a guest account** and you are prompted to enter your email address and password.  
For this example, we are choosing to sign in with SSO.
- Select **Allow.**
- Your connection has been added.
- Start Building your project by installing **Slack** package.

### **Build your project in the studio:**

- Create a new automation project by clicking blank process and rename it and open.
- Install the **UiPath.Slack.Activities**  **v1.1.0** ( **not compatible with cross-platform** ) package (for working with Slack scope)

Preview versions of the Slack activity pack prior to 1.0.3 do not work alongside the [Invoke Code](https://docs.uipath.com/activities/docs/invoke-code) activity pack and you are unable to run a process when they are both installed. This was fixed in Slack version 1.0.3 (released in 2021).

### How to use **Invoke Slack Operation**  **activity?**

**Step 1:** Use slack scope and configure, API token must be same for both Design and Robot connection.

 ![image-20230203-055350](https://global.discourse-cdn.com/uipath/original/4X/9/c/0/9c098d17059d0c5225d93153f6fd0c4652ade3f5.png)  
**Step 2:** Now drag and drop **Invoke Slack Operation**  **activity** , here you can make use of different methods (under category) and type of operation you need (Operation Name).  
 ![image-20230203-055432](https://global.discourse-cdn.com/uipath/original/4X/e/d/6/ed6796880aa6699730eb04b12d242dc2460b0a31.png)

- Choose according to your requirements and provide the desired value in the value section (Editable) and click done after configured.
- You can even use other default activities present in the **UiPath.Slack.Activities**

#### **Note:**

- Install the **Slack v3.5.3** ( **not compatible with windows legacy** ) package (for working with cloud integration service)
- Install **UiPath.WebAPI.Activities** package (for working with incoming webhooks and web API slack methods)

### How to configure HTTP for **web API slack** methods?

 ![image-20230208-072252](https://global.discourse-cdn.com/uipath/original/4X/8/4/9/8498cd5e5101740f6cf4d0824968fa5332f6ced1.png)

- ![]()

**Endpoint:** provide the desired Endpoint URL, it changes depending on the requirements

- **Request method:** select the methods based on API key (GET, POST, UPDATE etc.,)
- **Accept response:** response from the API request it can be JSON, XML or anything. As of now slack API response is **JSON.**
- **Parameters:** If that desired method requires any mandatory parameters provide here
- **Attachments:** Used when you want to add any file attachments
- **Authentication:** authentication types are Simple HTTP, OAuth1 and OAuth2 (requires access token key)
- That’s all you can start building your automation.

**Each and every method has its own advantages and disadvantages, choose accordingly based on requirement.**

### Comparison on Different Methods

| **Slack scope Integration** | **Integration Service** | **Web APIs** |
| --- | --- | --- |
| Does not require URLs. | Does not require URLs. | URLs are required for every method. |
| A single slack scope has been configured and all the slack activities can be used inside. | All the activities are connected automatically once the connection has been made in the Integration service (Automation cloud). | The access token code must be provided for every HTTP request. |
| Consumes less time as we must only provide the values. | Consumes less time as we must only provide the values. | Consumes more time as we must manually add the parameters and the value. |
| Can create an output variable in the given activity and use it in other activities. | Can create an output variable in the given activity and use it in other activities. | Once the output variable is created, it is in JSON format, therefore it must be de-serialized to get the required details. |
| User friendly, as the activities itself tells the user what to do. | User friendly, as the activities itself tells the user what to do. | Requires programming knowledge and understanding about how request has been made and data is fetched/posted. |
| Built-in slack activities are present in the integrations tab in the activities panel. | Built-in slack activities are available in the integrations service tab in the activities panel. | There are no built-in activities, HTTP request is used to post/get data. |
| UiPath.Slack.Activities package must be installed. | UiPath.Slack.IntegrationService.Activities must be installed. | UiPath.WebAPI.Activities has to be installed. |

## To be known

- You can Add users to channels using **member ID only** (this will happen once the user was added into that particular workspace)

#### **How to get member ID of a person and channel ID in slack?**

Go to user profile → view full profile → click on the 3 dots → scroll down you will find member ID.

Go to channel → click on the channel and scroll down you can find channel ID.

- User cannot be removed from #general channel.
- To schedule a message, you need to convert date time format to timestamp ([click here](https://timestamp.online/)).
