====== Slack Integration ====== Slack is a communication and collaboration platform. If you have created a team in Slack and are maintaining customer relationship through the Slack team, you can create Slack App and bot for the team, bind the App to Hyphenate Customer Engagement Cloud, and provide customer service through the Slack bot. Follow these steps: - [[#create_slack_app|Create Slack App]] - [[#add_bot_user|Add Bot User]] - [[#install_slack_app|Install Slack App]] - [[#create_slack_account|Create Slack account]] - [[#authorize_slack_bot|Authorize Slack Bot]] Note: The Slack channel is a value-added service. To activate it, please provide the tenant ID and contact Hyphenate. ===== Create Slack App ===== 1. Open https://api.slack.com/apps in your browser, go to "Your Apps", and click **Create an App**. {{:cs:300visitoraccess:admin-channel-slack.png?nolink|Your Apps}} 2. On the "Create an App" window, enter an App Name, select a Development Slack Team, and click **Create App**. {{:cs:300visitoraccess:admin-channel-slack1.png?nolink|Create app}} After you create an app, the app settings page is displayed. ===== Add Bot User ===== On the App settings page, choose **Bot Users**, click **Add Bot User**, set the bot user information, and click **Add Bot User**. {{:cs:300visitoraccess:admin-channel-slack3.png?nolink|Add bot user}} ===== Install Slack App ===== 1. On the App settings page, choose **Basic Information**, view "App Credentials", and write down the “Client ID” value. {{:cs:300visitoraccess:admin-channel-slack4.png?nolink|App Credentials}} 2. On the App settings page, choose **OAuth & Permissions**, click **Add a new Redirect URL**, enter a redirect url, click **Add**, and then click **Save URLs**. Format of the redirect url: https://kefu.easemob.com/v1/slack-channels/oauth/callback/{tenantId}/{clientId} * tenantId: your tenant ID on Hyphenate Customer Engagement Cloud. To find it, go to "Admin Mode > Settings > Company". * clientId: Client ID of your Slack App. To find it, go to "Basic Information" on your App settings page (see Step 1). Example of a complete redirect url: https://kefu.easemob.com/v1/slack-channels/oauth/callback/16038/19678373537.193968334981 {{:cs:300visitoraccess:admin-channel-slack5.png?nolink|Add a new Redirect URL}} 3. On the "OAuth & Permissions" page, select Permission Scopes and click **Save Changes**. Set the following Permission Scopes: * bot * channels:history * groups:history * im:history * mpim:history * team:read * users:read {{:cs:300visitoraccess:admin-channel-slack6.png?nolink|Select permission scopes}} 4. On the App settings page, choose **Event Subscriptions**, turn on the "Enable Events" switch, and add a request URL in the Request URL field. Format of the request url: https://kefu.easemob.com/v1/slack-channels/events/callback/{tenantId}/{clientId} * tenantId: your tenant ID on Hyphenate Customer Engagement Cloud. To find it, go to "Admin Mode > Settings > Company". * clientId: Client ID of your Slack App. To find it, go to "Basic Information" on your App settings page (see Step 1). Example of a complete request url: https://kefu.easemob.com/v1/slack-channels/events/callback/16038/19678373537.193968334981 {{:cs:300visitoraccess:admin-channel-slack7.png?nolink|Add request URL}} 5. On the "Event Subscriptions" page, set "Subscribe to Bot Events", and click **Save Changes**. Subscribe to the following Bot Events: * message.channels * message.im * message.groups * message.mpim {{:cs:300visitoraccess:admin-channel-slack8.png?nolink|Subscribe to bot events}} After you save Event Subscriptions, the Verification Token is generated in the App Credentials area on the Basic Information page. 6. On the App settings page, choose **Install App**, and click **Install App to Team**. {{:cs:300visitoraccess:admin-channel-slack9.png?nolink|Add App to your team}} 7. Confirm the authorization information, and click **Authorize**. {{:cs:300visitoraccess:admin-channel-slack10.png?nolink|Authorize}} At this point, Slack App is successfully installed into your Slack Team, and you can see you Slack Bot on the DIRECT MESSAGES list on your Team's homepage. ===== Create Slack Account ===== 1. On the App settings page, choose "Basic Information" and go to "App Credentials". {{:cs:300visitoraccess:admin-channel-slack11.png?nolink|App Credentials}} 2. On another web page, log in to Hyphenate Customer Engagement Cloud, go to "Admin Mode > Channels > Slack", and click **Add Slack Account**. {{:cs-en:admin:start-slack.png?nolink|Slack channel account}} 3. Enter the account name, and copy Client ID, Client Secret, Token from the "App Credentials" of your Slack app to Hyphenate, and click **Save**. ===== Authorize Slack Bot ===== 1. Set the authorization address. Authorization address format: https://slack.com/oauth/authorize?scope =bot&client_id={clientId} * clientId: Client ID of your Slack App. To find it, go to "Basic Information" on your App settings page. Example of a complete authorization address: https://slack.com/oauth/authorize?scope=bot&client_id=19678373537.193968334981 2. In your browser, open the above authorization address, confirm the authorization information, and click **Authorize**. {{:cs:300visitoraccess:admin-channel-slack14.png?nolink|Authorize ChatBot}} When authorization is successful, you can send messages to ChatBot in your Slack Team and reply to the messages on Hyphenate Customer Engagement Cloud. The replies are sent through the ChatBot. ^Slack channels^Messaging mode^ |Direct Message|Customers send direct messages to ChatBot, and agents reply to the messages on Hyphenate Customer Engagement Cloud| |Public Channel|Customers send @chatbot messages, and agents reply to the @ messages on Hyphenate Customer Engagement Cloud| |Private Channel|same as above| |Group Direct Message|same as above|