You’ll need to have permission to create a Slack app to complete this tutorial. You’ll also need permission in Salesforce to create a Remote Site.
Before you can enable Slack notifications, you’ll need to follow these instructions to create a Slack app:
- Sign into Slack.
- Navigate to https://api.slack.com.
- Click the Create an app button.
- Select the From scratch option.
- Fill in the App Name (e.g. “Kubaru”).
- Select your Slack workspace.
- Click the Create App button.
- Under App features and functionality, click the Incoming Webhooks tile.
- In the top-right corner of the Activate Incoming Webhooks card, click the toggle to On.
- In the left menu, click OAuth & Permissions, then scroll down to the Scopes section.
- Under Bot Token Scopes, click the Add an OAuth Scope button, then search for and select “chat:write”.
- We suggest downloading the Kubaru logo to use as your app’s icon. To do so, open this link, right-click the image and select Save image as, and save the file to your computer.
- Back in your Slack app, at the top of the left menu, click into Basic Information.
- Scroll down to the Display Information section, and under App icon & Preview click + Add App Icon. Navigate to and select the logo image file you saved.
- At the top of this same page under the Install your app section, click the Install into Workspace button.
- Select an existing channel under the Where should [App Name] post? section, or create a new one and refresh the page so you can select it.
- Click the Allow button. You will be redirected back to the Basic Information page and should see a success message indicating that your app has been installed.
- In the left menu, click OAuth & Permissions.
- Under OAuth Tokens for Your Workspace you will see a Bot User OAuth Token. Click the Copy button on the right and hold onto it for now.
Next you’ll need to connect your Slack app to your Salesforce org:
- Sign into Salesforce and navigate to the Setup menu.
- Search for and select Remote Sites using the Quick Find search bar.
- Click the New Remote Site button.
- For the Remote Site Name, enter “Slack”.
- For the Remote Site URL, enter “https://slack.com”.
- Click Save.
- Navigate to the Settings tab of the Kubaru Console.
- In the Notifications section, click the Add Token link under Slack Notifications.
- Paste the API token you copied previously and click the Validate Token button. You should see the message “Slack API token is valid.” If not, you’ll want to verify that the token you entered is correct.
- Click Save Token.
- Update your Slack Notifications setting from “Disabled” to “Enabled” or “Enabled, users can override”.
And that’s it – whew! Nice work 🥳
Things to keep in mind