This package is intended to give Admins the capability to send highly customized slack messages via process builder or visual flows.
Test in sandbox first! You will first need to authorize your org(s). Checkout Trailhead to get started with SFDX.
git clone [email protected]:mikesimps/sfdc-slack.git
cd sfdc-slack
sfdx force:source:convert -d deploy -r force-app
sfdx force:mdapi:deploy -d deploy -u YOUR_ORG -l RunSpecifiedTests -r SlackPostActionTEST
Be sure to also grant users to the Slack Admin
permission set that will be able to manage the webhook entries.
You will need to create your own App in your Slack workspace as an admin or have your admin create the app and add you as a collaborator. Documentation for this setup is pretty straight forward.
https://api.slack.com/slack-apps
Ultimately, you need an incoming webhook URL that is unique for your workspace and channel. The screen will look similar to the image below. That URL will be required when adding webhook records to the custom object. These urls do not require authentication so be careful with who you expose these to.
Once you have the URLs you will need to add them to the custom object. Be sure to note the Name you use as it will be required when building the process builder.
Most of the fields are straightforward text values and will match exactly with the slack message api specification. The only required values for you to specify are the Webhook Name from the record you created and the text you want to send.
If you decide to do a more complex attachment message, for each of your fields will need to be text values that presented as a JSON object.
{
"title": "TEST FIELD 1",
"value": "Something Here1\nSomething Else1",
"short": false
}
Flattened it looks like this:
{ "title": "TEST FIELD 1","value": "Something Here1\nSomething Else1","short": false}
Notice the \n
in the value text. This is how you get the text to display on separate lines. It is recommended that you create a formula to build this text. For example:
'{"title": "TEST FIELD1","value":"' + Custom_Value_Field__c + ',"short":false"}'
Where Custom_Value_Field__c is a formula on the object you want to display with the value of Some_Field__c + '\n' + Some_Other_Field__c
. If you are doing an extensive message (like notification of an Opportunity Closing, this could get quite lengthy and is a good idea to have it as a dynamic formula rather than hardcoded in the process).
If you have questions that are not clarified by the documentation, please feel free to submit an issue for clarification. Additional contributions are always welcomed!