Slack message processor

From MoodleDocs

This plugin provides a message processor for Slack. A site can configure a Slack team to be used for message outputs. Then, any Moodle users who are members of that Slack team can configure their account to be connected to a Slack channel.

Configuring the plugin settings

At the Slack plugin main settings page (Plugins / Message outputs / Slack), you will need to configure the Team URL, Client ID and Client secret for the Slack plugin. Once the plugin is installed, you will see:

slacksetupscreen1.png

You can enter your Slack Team URL now, but you will need to do some steps on Slack to get the other two bits. Make sure you are logged into your Slack team site as an administrator, and go to https://api.slack.com/apps. You'll see a screen like:

mainappscreen.png

Click the "Create an App" button, and you should see:

createapp.png

Enter a name for your App. If you have more than one Slack team, you will have to choose the one you want to use. Then click "Create App":

appcreatedscrolldown.png

If you scroll down a bit on the resulting screen you will see the Client ID and Client Secret you need to enter on the Moodle Slack plugin settings screen (you have to click the "Show" button on the secret to see it). Leave this site open, as we need to do a few more steps, but go ahead and transfer the Client info to the plugin settings and save:

completesettings.png

Go back to the Slack Apps screen. Look down the left menu for the "OAuth & Permissions" link. Click that and it will take you to the OAuth screen:

oauthredirecturl.png

You need to add a redirect URL to the Slack script on your Moodle site. The URL is your Moodle URL, followed by '/message/output/slack/slackconnect.php'. Scroll down and click the "Add a new Redirect URL" button:

addnewredirecturl.png

Enter the URL as above, and click the "Add" button. You will need to authorize a channel to post to. I recommend selecting your own name:

authorizeslack.png

You may need to click the "Save URLs" button after this, if it is displayed. But now Slack should have everything it needs to work with your site.

Configuring user preferences

Once Slack is configured for your site, users can connect their Slack accounts to receive notifications and messages from Moodle. This is done in the user preferences screen under the notification preferences. On that screen, you will see a column for Slack, and it will show the "alert" icon indicating that it has not been configured. Click on that link to open the Slack settings dialogue:

slackpreferences2.png

Click the "Add to Slack" button, and the user account will be connected to Slack. Now, the user can select what messages and notifications they wish to receive through Slack.