Integrate Slack 编辑

Deploy the Slack integration to provide additional monitoring capabilities for critical channels that may not be traffic intensive but require the attention of its members. In order to tailor the channels available to a specific group or department, use multiple integrations.

Note:

We want your feedback! Please provide feedback for this integration template as you use it. For any issues, our team will also monitor our dedicated forum on a daily basis.

For comprehensive details of the out-of-the-box microapp for Slack, see Use Slack.

Review prerequisites

These are the values that you enter in Citrix Workspace Microapps:

  • Base URL: https://slack.com/api
  • Authorization URL: https://slack.com/oauth/authorize
  • Token URL: https://slack.com/api/oauth.access
  • Channel ID: You collect this when you create a new favorites channel in Slack. You need this to modify endpoints and service actions. See Create a favorites channel and collect Channel ID.
  • OAuth Access Token: You enter this as the Token value when setting up the integration template. You collect this token, the Client ID, and the Client Secret when you Create Bot.
  • Client ID: The client ID is the string representing client registration information unique to the authorization server.
  • Client Secret: The client secret is a unique string issued when setting up the target application integration.

Note:

It is recommended that you always use OAuth 2.0 as your service authentication method where available. OAuth 2.0 ensures that your integration meets the maximum security compliance with your configured microapp.

Create a new service account

The integration requires regular access to your Slack instance. We recommend creating a dedicated user account with full administrator privileges. Sign up here: https://slack.com/get-started.

Enable APIs

The number of API requests that can be made to specific resources is limited. We therefore recommend the following:

Create the Bot

Bots are Slack apps that interact with users, with the ability to post, receive, and respond to messages from users. Create the Slack app and select scopes to add to the app.

  1. Navigate to the Slack Management UI and create an app if you haven’t already created one: https://api.slack.com/apps
  2. Enter an App Name, and select the Development Slack Workspace where the app will be installed.
  3. Select Create App.
  4. Under Basic Information, copy the following App Credentials information:
    • Client ID
    • Client Secret
  5. Navigate to OAuth & Permissions under Features on the left sidebar.
  6. Under Scopes/Bot Token Scopes, select Add an OAuth Scope tile under the Scopes section, Ensure that you add scopes to the Bot Token, not your User Token. Add these scopes: channels:history channels:join channels:read groups:history groups:read mpim:history mpim:read team:read users.profile:read users:read users:read.email
  7. Under Redirect URLs, for each of the following callbacks select Add New Redirect URL, enter the value, and select Save URLs when you’re finished.
    • https://{yourmicroappserverurl}/admin/api/gwsc/auth/serverContext
    • https://{yourmicroappserverurl}/app/api/auth/serviceAction/callback

Install the Slack app

Install the app to your Slack workspace to test your app and generate the tokens needed to interact with the Slack API.

  1. Navigate to Install App under Settings on the left sidebar.
  2. Select Install App to Workspace, ensure the app is permitted to Perform acitons in channels & conversations, and select Allow.
  3. Copy the Bot User OAuth Access Token.

Create a favorites channel and collect Channel ID

Create a channel for tracking favorites. You need to collect the Channel ID from the URL of this channel for modifying the integration.

Note:

If using multiple Slack integrations, use a separate/dedicated favorite channel for each integration.

  1. Create a new channel in Slack named favorites.
  2. Select Add all members of {SlackWorkspaceName}
  3. Copy the channel link. Save the ID at the end of the URL. This is your Channel ID you need to modify endpoints and service actions. See Modify endpoints and service actions.

Add the Bot to focus and favorite channels

Now add the Bot (Slack app) to any channels that you want to expose to the team that subscribes to the app and the favorite channel created above. Consider the following:

  • Do not add a Bot to a noisy channel. Bots should be added to channels that are used for infrequent, time-critical communications within a select group, such as urgent sales issues for the Sales Group or IT security for General Employees.
  • Multiple integrations can point to the same Slack app.
  • Keep the channel list focused on a specific group.
  • We only recommend adding the Bot to a public channel. Adding bots to a private channel may allow others to view membership of the private channel.

Add the integration to Citrix Workspace Microapps

Add the Slack integration to Citrix Workspace Microapps to connect to your application. The authentication options are preselected. Ensure that these options are selected as you complete the process. This delivers out-of-the-box microapps with pre-configured notifications and actions that are ready to use within your Workspace.

Follow these steps:

  1. From the Microapp Integrations page, select Add New Integration and Add a new integration from Citrix-provided templates.
  2. Choose the Slack tile.
  3. Enter an Integration name for the integration.
  4. Enter Connector parameters.
    • Enter the instance Base URL: https://slack.com/api
    • Select an Icon for the integration from the Icon Library, or leave this as the default icon.

    Connection parameters

  5. Under Service Authentication, select Bearer Token from the Authentication method menu and complete the authentication details. The authentication options are preselected. Ensure that these options are selected as you complete the process.
  6. Enter the Token. This value is the Bot User OAuth Access Token that you collect when you created the bot. See Create the Bot.

    Authentication

  7. Under Service Action Authentication, enable the Use Separate User Authentication in Actions toggle. This authenticates at the service action level. The authentication options are preselected. Ensure that these options are selected as you complete the process.

    1. Select OAuth 2.0 from the Authentication method menu and complete the authentication details.
    2. Select Authorization code for Grant type flow menu.
    3. Enter authorization_code for Grant type value. Callback URL is prefilled.
    4. Select Request Body from the Token Authorization menu.
    5. Select URL encoded form from the Token content type menu. The Authorization URL is prefilled: https://slack.com/oauth/authorize. The Token URL is prefilled: https://slack.com/api/oauth.access.
    6. Ensure the following is entered for Scope: channels:history channels:join channels:read groups:history groups:read mpim:history mpim:read team:read users.profile:read users:read users:read.email
    7. Enter the Client ID that you obtained in Create the Bot.
    8. Enter the Client Secret that you obtained in Create the Bot.

    Service action

  8. Enable the Request Rate Limiting toggle and enter 1 for Number of requests per second.
  9. Enter 120 in the Request timeout field.
  10. (Optional) Enable Logging toggle to keep 24 hours of logging for support purposes.
  11. Select Save.

    Request rate

The Microapp Integrations page opens with your added integration and its microapps. Now modify the integration by adding the channel value as described in the next procedure.

Modify endpoints and service actions

To complete this set up, you need to add the channel value with your channel ID collect in Create a favorites channel and collect Channel ID. Modify the Favorite Channels endpoint and both the Favorite channel and Unfavorite service actions.

Replace Data Loading endpoint

Manually add the channel value in the Favorite Channels endpoint with your Channel ID.

  1. From the Microapp Integrations page, select the menu next to the Slack integration, and then Edit. The Data Loading screen opens. If you are in the configuration screen, select Data Loading from the left side navigation column.
  2. Select the menu next to the Favorite Channels endpoint and then select Edit, or select the name of the endpoint: Favorite Channels.

    Favorite channels

  3. In the Edit Data Endpoint screen, under Full synchronizations enter the Channel ID in the value field for channel.
  4. Select Apply at the bottom of the screen and confirm.

    Channel value

Replace Service Action variables

For the Favorite channel and Unfavorite service actions, you must manually add the channel value with your Channel ID twice for both service actions. Once under Action execution and once under Post action data update (optional).

  1. While editing the integration configuration, select Service Actions from the left side navigation column.
  2. Select the menu next to one of the service actions that you need to edit and select Edit, or select the name of the service action that you need to edit. Let’s start with the Favorite channel.

    Channels

  3. In the Edit Service Action screen under Action sequence and then under Action execution, select BODY.
  4. Enter the Channel ID in the value field for channel.
  5. Under Post action data update (optional), again enter the Channel ID in the value field for channel.

    Channel value

  6. Select Save to finish.
  7. Now repeat this for the other service action: Unfavorite. Add the channel value with your Channel ID twice. Once under Action execution and once under Post action data update (optional).

For more details of API endpoints and table entities, see Slack connector specifications.

Use Slack microapps

Existing application integrations come with out-of-the-box microapps. Start with these microapps and customize them for your needs.

My Favorite Channels: Receive notifications of activity in favorited channels.

Notification or PageUse-case workflows
Channels List pageProvides a list of favorited channels, with an option to Add Channels.
Channel Detail pageView details of a favorited channel including past posts. Includes button options to Post Message and Unfavorite Channel.
Message Detail pageView message details from a favorited channel, with details of the sender. Includes button options to Thumbs Up and View Replies In Slack.
Post a Message pageProvides a form to compose and button to Post a message to a favorited channel.
Add Channels Detail pageView details of a channel including members. Includes a button option to Add To Favorites.
Add Channels List pageProvides a searchable list of channels, with an option to view details on the Channel Detail page.

Post to Slack: Post a message to the selected focused channel in slack.

Notification or PageUse-case workflows
Post New Message pageProvides a form to compose and post a message.

Set My Slack Status: Set your slack status, create reminders, and enable Do Not Disturb for a set amount of time.

Notification or PageUse-case workflows
Create a reminder pageProvides a form to set a reminder.
Pause Notifications pageProvides a form to pause notifications for a set amount of time.
Set My Slack Status pageProvides a form to set a status, with options to Set Reminder and Do Not Disturb.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:96 次

字数:20121

最后编辑:8年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文