-
Notifications
You must be signed in to change notification settings - Fork 1
12)OmniChannel Integration
We have integrated Slack into our application so the clients and their respective employees can be immediately notified via Slack whenever someone is checked in.
Currently, we are storing the Oauth access token in local storage. Besides security, it limits the Slack Oauth authentication to one device. This means that every device that uses this application has to be authenticated through the steps in the "Setting It Up (Clients)" section below in order for those devices to activate Slack notifications for check-ins. Check-in WILL work without authentication but notifications will not be sent. A good way to approach this problem is to securely store a refresh token (if you can find it) or the access token in the database.
The clients (companies) can set up the Slack Integration by going into the "Settings" page located on the sidebar on the dashboard menu. On that page, there is a "Add To Slack" button that allows user to add our application integration into their own Slack account. They will be able select the team and channel that they want to add our integration to. Adding our integration will create a Slack bot in their team, usually under the default name "bot".
Because we are using our own Slack Application to make use of Slack's API, you will have to change the Client Secret and Client ID that our integration currently holds to your own Client Secret and Client ID that was generated for you. To set up our app with your Slack Application, follow the steps below:
- Create a Slack Application at https://api.slack.com/applications
- Enter in the required information and create the application
- You will be redirected to another page after creating the application successfully. You should see Client ID and Client Secret. YOU NEED THESE
- Grab the Client ID and Client Secret and go to the file at /client/assets/js/settings.js
- Replace the ClientID with the one associated with your Slack Application at line 19.
- Replace the ClientSecret with the one associated with your Slack Application at at line 20.
- Next, you will have to edit the "Add To Slack" button.
- Go to the file /client/assets/views/settings.html
<a href="https://slack.com/oauth/authorize?scope=incoming-webhook,bot,chat:write:bot&client_id=11293703667.21111100000"><img alt="Add to Slack" height="40" width="139" src="https://platform.slack-edge.com/img/add_to_slack.png" srcset="https://platform.slack-edge.com/img/add_to_slack.png 1x, https://platform.slack-edge.com/img/add_to_slack@2x.png 2x" /></a>- Replace the client_id field in the URL with your Client ID associated with your Slack application.