Post to Slack with Classic UI#
This guide shows you how to create a content rule that posts a message to Slack, using Classic UI. As an example, the rule reports every user login to a Slack channel.
Prerequisites#
contentrules.slack is installed, as described in Install contentrules.slack.
You have a Slack incoming webhook URL. To create one, follow Slack's guide Sending messages using incoming webhooks.
Create the content rule#
Open .
Select Add content rule.
Enter a Title, such as
User Logged In, and an optional Description.In Triggering event, select User Logged in.
Select Save.
Add the Slack action#
On the page of the new rule, select Post a message to Slack in the Action list, and select Add.
Fill in the form. The Slack action describes every field.
Use
${...}variables to include details about what triggered the rule. The table at the bottom of the form lists the available variables. This example uses the full name and email of the user who logged in.
Select Save.
The action appears under Perform the following actions.
Assign the rule#
A rule runs only in the places it is assigned to. Select Apply rule on the whole site to run it everywhere.
To run the rule only inside a folder, go to that folder, open its Rules tab, and add the rule there.
Check the result#
Log in to the site in another browser. A message appears in the Slack channel.
If no message appears, check the Plone log for errors from the contentrules.slack logger.
Python API lists the messages it writes.