ℹ️ This plugin requires
v4.7.1
or newer of Nebula Logger's unlocked package
Adds a Slack integration for the unlocked package edition of Nebula Logger. Any logs with log entries that meet a certain (configurable) logging level will automatically be posted to your Slack channel via an asynchronous Queueable
job.
This plugin includes some add-on metadata for Nebula Logger to support the Slack integration
- Apex class
SlackLoggerPlugin
and corresponding tests inSlackLoggerPlugin_Tests
- Plugin configuration details stored in Logger's CMDT objects
LoggerPlugin__mdt
andLoggerParameter__mdt
- Custom fields
Log__c.SendSlackNotification__c
andLog__c.SlackNotificationDate__c
- Field-level security (FLS) via a new permission set
LoggerSlackPluginAdmin
to provide access to the custom Slack fields - Two custom list views for the
Log__c
object to see anyLog__c
records that have, or should be, sent to Slack - Remote site setting for Slack's API
In order to use the Slack plugin, there are some configuration changes needed in both Slack and Salesforce
Within Slack, you'll need to setup incoming webhooks to allow the Logger Slack plugin to create messages. The high-level steps are:
- Create a new app in your Slack workspace (or use an existing app, if you prefer)
- Create a new incoming webhook for your app, and copy the webhook URL. This will be used in Salesforce (see below steps)
Check out Slack's webhooks documentation for more details on how to setup incoming webhooks.
- Ensure that you have the unlocked package version of Nebula Logger installed in your org
- Install the unlocked package for the Slack plugin
- Go to Setup --> Custom Metadata Types --> Logger Parameters. There are 2 parameters to configure (shown in screenshot below)
- Parameter 'Slack Endpoint' - You can configure this webhook in 1 of 2 ways:
- Easier but less secure: Paste the Slack webhook URL into the
Value__c
field and save the Plugin Parameter record. - More secure: Create a new Named Credential, using the webhook URL as the endpoint. Within the Parameter 'Slack Endpoint', enter
callout:<your named credential>
into theValue__c
field and save the Plugin Parameter record
- Easier but less secure: Paste the Slack webhook URL into the
- Parameter 'Slack Notification Logging Level' - Set the desired logging level value that should trigger a Slack notification to be sent the Logger Plugin Parameter 'Slack Notification Logging Level`. It controls which logging level (ERROR, WARN, INFO, DEBUG, FINE, FINER, or FINEST) will trigger the Slack notifications to be sent.
- Parameter 'Slack Endpoint' - You can configure this webhook in 1 of 2 ways:
The Slack integration should now be setup & working - any new logs that meet the specified notification logging level (step 6 above) will send a Slack notification.