Difference between revisions of "Configuring Notifications with Slack"

From WHMCS Documentation

m
(DOCS-6972)
Line 11: Line 11:
 
===Creating an App for Slack===
 
===Creating an App for Slack===
  
1. Begin by visiting https://api.slack.com/
+
1. Begin by logging into your Slack Workspace
  
2. Click the '''Start Building''' button to start the process of creating a new app. You will need to login if you haven't already.
+
2. Visit https://api.slack.com/
  
3. Enter a name for the app.  We recommend something like 'WHMCS'.  Also choose the workspace you wish to add the app to. Then click continue.
+
3. Click the Start Building button to start the process of creating a new app. You will need to login if you haven't already.
  
4. Under the '''Add features and functionality''' heading, select the '''Permissions''' option.  
+
4. Enter a name for the app. We recommend something like 'WHMCS'. Also choose the workspace you wish to add the app to. Then click continue.
  
[[File:Slack-permissions.png]]
+
5. Under the Add features and functionality heading, select the Permissions option
  
5. On the following screen, scroll or auto-search to the Scopes section and add the following bot token scopes:
+
[[File:Slack_features.png|500px]]
  
* Access information about user’s public channels (''channels:read'')
+
6. Scroll down to Scopes: Both Token Scopes
* Join channels in the workspace (''channels:join'')
 
* Send messages as WHMCS (''chat:write'')
 
* Access information about user's private channels (''groups:read'')
 
  
[[File:Slack-scopes.png]]
+
7. Click "Add an OAuth Scope" and assign the following permissions:
  
6. Now navigate to '''Install App''' in the sidebar.
+
* channels:read
 +
* chat:write
 +
* groups:read
  
[[File:Slack-install.png]]
+
[[File:Slack_scopes.png|500px]]
  
7. Click the Install App button.
+
9. Click Install App to Workspace
  
8. Confirm you authorize the permissions for the app that you just configured.
+
[[File:Slack_install_to_workspace.png|500px]]
  
[[File:Slack-authorize.png]]
+
9. Confirm you authorize the permissions for the app that you just configured.
  
9. You will now be presented with the '''OAuth Access Token''' you need for WHMCS integration. Copy this value.
+
10. You will now be presented with the Bot User OAuth Access Token you need for WHMCS integration. Copy this value.
  
[[File:Slack-oauth-token.png]]
+
[[File:Slack_oauth.png|500px]]
  
10. Now return to WHMCS and navigate to '''Setup > Notifications'''.
+
11. Now return to WHMCS and navigate to Setup > Notifications.
  
11. Under the Slack notification provider, click '''Configure'''
+
12. Under the Slack notification provider, click Configure
  
12. Enter the OAuth Access Token you copied in step 9 into the OAuth Access Token input field and hit '''Save Changes''' to complete the process.
+
13. Enter the Bot User OAuth Access Token you copied in step 10 into the OAuth Access Token input field and hit Save Changes to complete the process.
 +
 
 +
[[File:Whmcs_slack_oauth.png|500px]]
 +
 
 +
14. In the Slack app, enter the channel into which you wish the notifications to appear
 +
 
 +
15. Invite the newly created bot in the same way as a regular user. In the example, we use "WHMCS" as our Bot Name:
 +
 
 +
[[File:Slack_invite_bot.png|500px]]
  
 
WHMCS will attempt to verify the OAuth Access Token provided. If the verification fails you will receive an error message. Check the Access Token is entered correctly, has all the required scopes and try again. If successful, the modal will close and you will now be able to send notifications to Slack.
 
WHMCS will attempt to verify the OAuth Access Token provided. If the verification fails you will receive an error message. Check the Access Token is entered correctly, has all the required scopes and try again. If successful, the modal will close and you will now be able to send notifications to Slack.
  
 
You are now ready to [[Notifications#Creating_a_Notification_Rule|Create Your First Notification Rule]].
 
You are now ready to [[Notifications#Creating_a_Notification_Rule|Create Your First Notification Rule]].

Revision as of 16:09, 2 June 2020

Configuring Notifications with Slack allows you to receive notifications in your Slack channels when events occur within WHMCS.

For more information on Notifications, please refer to the Notifications Documentation.

Configuring Slack Notifications

To enable WHMCS to communicate with the Slack API, WHMCS requires an OAuth Access Token.

You can create an OAuth Access Token quickly and easily by following the steps below.

Creating an App for Slack

1. Begin by logging into your Slack Workspace

2. Visit https://api.slack.com/

3. Click the Start Building button to start the process of creating a new app. You will need to login if you haven't already.

4. Enter a name for the app. We recommend something like 'WHMCS'. Also choose the workspace you wish to add the app to. Then click continue.

5. Under the Add features and functionality heading, select the Permissions option

Slack features.png

6. Scroll down to Scopes: Both Token Scopes

7. Click "Add an OAuth Scope" and assign the following permissions:

  •  channels:read
  •  chat:write
  •  groups:read

Slack scopes.png

9. Click Install App to Workspace

Slack install to workspace.png

9. Confirm you authorize the permissions for the app that you just configured.

10. You will now be presented with the Bot User OAuth Access Token you need for WHMCS integration. Copy this value.

Slack oauth.png

11. Now return to WHMCS and navigate to Setup > Notifications.

12. Under the Slack notification provider, click Configure

13. Enter the Bot User OAuth Access Token you copied in step 10 into the OAuth Access Token input field and hit Save Changes to complete the process.

Whmcs slack oauth.png

14. In the Slack app, enter the channel into which you wish the notifications to appear

15. Invite the newly created bot in the same way as a regular user. In the example, we use "WHMCS" as our Bot Name:

Slack invite bot.png

WHMCS will attempt to verify the OAuth Access Token provided. If the verification fails you will receive an error message. Check the Access Token is entered correctly, has all the required scopes and try again. If successful, the modal will close and you will now be able to send notifications to Slack.

You are now ready to Create Your First Notification Rule.