Activities
latest
false
Banner background image
Classic Integrations Activities
Last updated Apr 22, 2024

Quickstart - Channels and Messages

Overview

The purpose of this guide is to help you create a working sample with different Slack activities, including Create Channel, Invite to Channel, Send Message, and Get Messages.

This working sample enables you to quickly verify the connection to your Slack workspace and get familiar with the included activity's input/output datatypes.

After completing the steps in this guide, you'll have an automation sequence that does the following:

  1. Establishes a connection to your Slack workspace (Slack Scope).
  2. Creates a new channel in your Slack workspace (Create Channel).
  3. Invites a user to your new channel (Invite to Channel).
  4. Sends a message to the channel (Send Message).
  5. Verifies the results of the Create Channel, Invite to Channel, and Send Message activities by outputting the channel's messages and user information (Get Messages, For Each, and Write Line).



Prerequisites

Before you begin:

  1. Complete the Slack Setup steps.

Steps

Build your project
  1. Add the Slack Scope activity to your project.
  2. Enter the ClientID for your Slack app.
  3. Enter the ClientSecret for your Slack app.

    • For more information about the Client ID and Client Secret, see Create new Slack app in the Setup guide.
  4. From the Scopes drop-down list, select all of the listed scopes.

    * For more information about scopes, see Add app permissions in the Setup guide.

  5. Click the Connect button in the Design Panel.

    * For more information about this button, see Connect and Revoke Token in the Slack Scope activity details page.

  6. Add the Create Channel activity after the Slack Scope activity.
  7. Create and enter a String variable for your Channel Name (e.g, channelName with default value "slack_quickstart").
  8. Create and enter a String variable for the ChannelID (e.g., newChannel)
    • For more information about the allowed name values, see Channel Name in the Create Channel activity details page.
  9. Add the Invite to Channel activity after the Create Channel activity.
  10. In the Channel property, enter the String variable you created for the ChannelID property in the Create Channel activity (e.g., newChannel).
  11. Enter a Slack user that you want to invite to the channel using the Slack's username syntax (e.g.,"Jean.Grey").

    • You must enter a user that belongs to the workspace that you're Slack Scope is connected to.
  12. Add the Send Message activity after the Invite to Channel activity.
  13. In the Conversation property, enter the String variable you created for the ChannelID property in the Create Channel activity (e.g., newChannel).
  14. Create and enter a String variable for the Text property (e.g., messageText with default value "Welcome to "+channelName).
    • While it's good practice to create and enter a Message variable for the Message output property, for this example you'll not need to because it is not applicable when you verify the activity results.


Test your project
  1. To verify that your new channel was created, the users invited, and the message was sent successfully, add the Get Messages activity after the Send Message activity.
  2. In the Conversation property, enter the String variable you created for the ChannelID property in the Create Channel activity (e.g., newChannel).
  3. Create and enter a Message[] variable for the Messages output property (e.g., slackMessages).
    • When creating your variable, select UiPath.Slack.Models.Message[] as your variable type.
  4. To process and see the output of your sent message, after the Get Messages activity, add the activity with the If and activities.
  5. In the TypeArgument property, select UiPath.Slack.Models.Message.
  6. In the Values property, enter the Message[] variable you created for the Messages output property in the Get Messages activity (e.g., slackMessages).
  7. For the If activity Condition statement, enter the following parameters to narrow down the Get Messages output to the message you sent with the Send Message activity: item.Text.Equals(messageText).
  8. In the Then statement box, add the Write Line activity.

    1. For the Text property, enter item.User+" : "+item.Text to output the message text and your user ID for verification in the output window.
  9. In the Else statement box, add another Write Line activity.

    1. For the Text property, enter item.User+" : "+item.Text to see all the user IDs that "joined" from the Invite to Channel activity.
  10. Click Start and verify the results in the output window.



You're done!

When you're ready, try the other Quickstart guides to get more familiar with the different Slack activities.

To learn more about the Slack activities (including example property inputs/outputs), see the Activities page for a complete activity list and links to the activity detail pages.

  • Overview
  • Prerequisites
  • Steps

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.