If you're a heavy Slack environment there are a lot of useful alerts you can send from Rock RMS to Slack with a few simple steps! We are using this type of workflow to post staff birthdays/work anniversaries, as well as to post alerts to specific channels when Connection requests come in. There are plenty of uses for Slack alerts!

Setup a Slack Workflow to receive messages

In your Slack environment you'll need to set up a Slack Workflow to provide a webhook for Rock to use for posting messages. You'll need to create a Slack workflow for each channel you'd like to post to (and I would suggest setting up a test channel to start with). This guide will walk you through setting up a workflow for posting to your general channel.

1. In your Slack environment navigate to Tools -> Workflow Builder

2. Click "Create" and name your new workflow (This name will be posted along with your message, so you'll want to name it well)

3. Choose "Webhook" as the method used to start the workflow

4. Click "Add Variable", and name it as desired. The Key is the variable name, and Data Type should be "text". I used "rockrms_message", as this variable will contain the message sent from Rock to Slack.

Screen_Shot_2020-06-18_at_2.48.44_PM.png

5. Once you publish the Workflow you will receive the Webhook URL. Copy that and store it for later.

6. Edit the workflow. You should see the Webhook Step, add a second step to receive a message. Click "Add Step" and pick "Send a message". Pick the channel to post to (again, this should probably be a test channel!) and then for the Message text click "Insert a Variable" and pick the "rockrms_message" variable. Click Save, and don't forget to Publish the changes!

Screen_Shot_2020-06-18_at_11.28.10_AM.png

7. In the Workflow settings you may want to assign an icon - we're using our church square logo.

Setup a Rock RMS Workflow to post the message

The Rock Workflow is only two parts - load the message to a variable, and then post the message to a webhook. The tricky part is the webhook is sensitive to whitespace. If a message doesn't work check for extra spaces!

1. Create a new Rock Workflow

2. Create two Attributes:

  • "POST Response" with Field Type "Text"
  • "JSON String" with Field Type "Text"

3. In the Start Activity, create an Action of Type "Lava Run" for building your message. Assign the "JSON String" Attribute to the Action below the Lava field.

In the lava field you'll want to assign your message to a temporary attribute and then use lava to display the attribute, which will load it to the JSON String variable. Enable "Rock Entity".

Screen_Shot_2020-06-18_at_11.36.56_AM.png

4. Create a 2nd Action of Action Type "Web Request" with Method "Post". Copy/Paste the Slack Webhook from earlier into the URL field, and leave Request Content Type and Response Content Type set to "JSON".
Set a filter to only activate if the JSON String Attribute is not empty, or Slack will get blank messages from Rock!
The body needs to be a very specific format as follows, with the first variable matching what you used in the Slack Workflow:

{
"rockrms_message": "{{ Workflow | Attribute:'JSONString' }}"
}

Set the Response Attribute to the "Post Response" attribute (I'm not sure this is actually needed).

Screen_Shot_2020-06-18_at_11.37.52_AM.png

Screen_Shot_2020-06-18_at_3.19.45_PM.png

5. Complete the workflow as desired, and you're done! When you activate the workflow you should see a message come through your test channel! Now you can craft custom message and alerts in the Lava field, and set up Jobs or Event Triggers to trigger the Slack messages at specific times/events if desired.