Sample app to showcase Slack + Salesforce integrations using the Apex SDK for Slack.
To be able to run this project you will need:
- A brand new free Developer Edition org or a scratch org.
- A Slack workspace. You can create a free workpaces following the instructions here.
git
(download here)node
>= 14 (download here)sfdx
CLI >= sfdx-cli/7.142.0 (download here)
-
In your org, accept Slack integrations terms on
setup --> Initial Slack setup
-
In your org, accept Apex SDK terms on
setup --> Build Slack Apps with Apex
Note: if you're using scratch orgs, you'll have to accept terms in your Dev Hub
- Open https://api.slack.com/apps/new and choose From an app manifest
- Select the workspace you created in the Prerequisites section
- Copy the contents of manifest.json into the text box that says Enter app manifest below and click Next
- Review the configuration and click Create
- Replace APP_ID on the app manifest with the Id of your app and save changes. You can copy it from the URL for the app in api.slack.com.
- In Basic Information scroll down to the Display Information section. Upload a picture for the app. You can use this logo
- In Basic Information Generate an app level token for the
connections.write
scope. Give it an arbitrary name. - Now click Install App. Then click the Install to Workspace button and then click on Allow
- Clone the ready-to-fly-sdk repository
git clone https://github.com/albarivas/ready-to-fly-sdk
- Open ReadyToFlyPlaceHolder.slackapp-meta.xml and modify the secrets that you can copy from the Basic Information tab of your app at api.slack.com:
- appKey: App ID
- appToken: the value of the app-level token you've created
- clientKey: Client ID
- clientSecret: Client Secret
- signingSecret: Signing Secret
Rename the file to be called ReadyToFly.slackapp-meta.xml
. This file is ignored and won't be commited to the repo.
-
Replace your team Id into Slack_Workspace_ConfigurationPlaceHolder.Apex_SDK_Starter_Kit.md-meta.xml. You can get it from the URL when you navigate to https://your_workspace.slack.com/. Rename the file to be called
Slack_Workspace_Configuration.Apex_SDK_Starter_Kit.md-meta.xml
. This file is ignored and won't be commited to the repo. -
Deploy the code
sfdx force:source:deploy -p force-app/main/default
or, if using a scratch org:
sfdx force:source:push
- Assign permission set
sfdx force:user:permset:assign --permsetname Ready_to_Fly
- Load sample data
sfdx force:apex:execute --apexcodefile data/setup.apex
Note: the test data creation class assumes there is a "Standard Platform User" profile in your org. Change it accordingly if that's not your case.
- Go to your Slack workspace and click on "Add Apps". Select "Ready to Fly (SDK)".
Make sure to execute the /view-travel-request-status slash command or the "Create Travel Request" global shortcut to connect to the org for the first time. Your app home won't work until you execute this step.
Once done that, go to the app home tab --> you should see a couple of travevl requests to review!