Purpose
- The purpose of this article to demonstrate how notifications be sent to Slack or MS Teams or any other IM platform with public facing email addresses for channels or direct messages.
Required permissions
- DROOLS_CREATION_RULE (editing the drools)
- EDIT_RULES (creating a rule)
Instructions
1. Collect the email address from the Slack Channel or MS Teams channel. Those instructions can be found at the links below. This email will be used to send notifications to.
How to get an email address for a Microsoft Teams Channel
How to get an email address for a Slack Channel
2. Create a drool that has the following action and substitute your channel email appropriately.
insertLogical(new NotifyUserActionEvent($project.getUniqueId(), "EMAIL", "YOUR EMAIL HERE", "Project Workflow has been updated", "Body of the Email."));
3. An example is listed below that sends an email notification when the workflow state has been advanced.
package com.iriusrisk.drools;
import com.iriusrisk.drools.model.*;
import com.iriusrisk.drools.model.riskpattern.*;
import com.iriusrisk.model.*;
import com.iriusrisk.*;
import com.iriusrisk.drools.fact.*;
import com.iriusrisk.factories.DroolsValueConverter;
import com.iriusrisk.utils.EntityWithUDTUtil;
import com.iriusrisk.drools.fact.TagFact;
rule "Slack Notificationns"
no-loop
salience 9000
when
$project : ProjectFact()
$workflowState : WorkflowStateFact() @watch ( !currentWorkflowState );
UserEvent(type == "EVENT_NEXT_WORKFLOW_STATE");
then
insertLogical(new NotifyUserActionEvent($project.getUniqueId(), "EMAIL", "YOUR EMAIL HERE", "Project Workflow has been updated", "Body of the Email."));
end
4. The result in Slack will resemble the following screenshots:
Minimized -
And then fully expanded -
Comments
0 comments
Article is closed for comments.