Sending Centro Slack messages from Salesforce using Flow or Process Builder
Centro supports sending Slack messages from Salesforce using Salesforce Flow or Process Builder. This works on any object, and leveraging logic in Flow or Process builder, allows conditional events to trigger a Slack message in Centro's format.
Common use cases:
- Sending a Lead message to Slack on specific Lead Sources
- Notify a group when an Opportunity has Closed Won
- Send a Project milestone message when completed
As usual, the format of the message is governed by the object's default Compact Layout. Some objects have specific Centro buttons, such as Email and SMS for those that have an Email field on the object.
Steps for configuring Salesforce Flow:
In this example, we'll attempt to notify a Slack channel when an Opportunity is set to Won. Note: if you'd like to incorporate other resources in the Slack Message, see this documentation.
- Go to Salesforce Setup->Flows
- Press "New Flow"
- Choose "Record Triggered Flow":
- We recommend using Auto-Layout:
- In the "Start" block, choose an object and pick Opportunity:
- Click "Edit" Next to "Trigger: A record is created". We need to change this to when records are updated:
- Now set the Condition Requirements. In this case, we want Opportunity Won (notice the selection for "When to run"):
- Now click the "+" button to add the Centro message:
- Click the item "Action" under "Interaction":
- Now search for Centro in the Action Search box:
- Give the Action a label, pick a channel, and change the header message:
- Save and Activate the Flow
- Try it out!
Steps for Configuring Process Builder
We'll use the same use case above, but instead of Flow we'll use process builder. Note, that Flow has some advantages in that we provide a Slack Channel picker, whereas in Process Builder you'll need to get the Channel ID manually from Slack.
- First, start a new Process in Process Builder. Go to Salesforce Settings -> Process Builder
- Configure the process to your needs. In the Opportunity Won example, we'll select Opportunity as our object, and select "when a record is created or edited" as our selection to start the process:
- Select the appropriate criteria. In this case, when the Conditions are Met, with the Opportunity Stage equaling "Closed Won":
- Next in the "Immediate Actions" choose Apex. Find the Apex class "Centro: Send a Record Notification to Slack". Then, add following required variable: "RecordID", "ChannelID", and "Message".
- For RecordID: set to the primary object's ID field (see example)
- For ChannelID: Set to the Slack Channel ID. You may find this in the URL of the Slack channel. Slack Channel IDs always start with a "C": (This is why using Flow is recommended):
- Message: this is the custom message you want before the block.
- Test it out by making the opportunity meet those conditions: