Apex SDK for Slack (Beta)
Documentation Changelog
Project Structure
App Metadata
Define a View
Onboarding with App Home
Accessibility
Assets
Data Providers
Expressions
Input Validation
Permission Scopes
Considerations and Limitations
App Home is a private space in Slack that’s shared by an app and a user. It’s useful for onboarding users, such as showcasing the app’s key features and including information and links to popular items.
Get users acquainted with your app with these onboarding block ideas. Use the Home tab to describe what the app helps users achieve. Also, use action verbs in button labels, like “Share Record” or “Post to Channel”.
App Home contains 3 tabs:
The Home and About tabs are required in Salesforce apps.
Introduce your app with a value proposition. Include 1-2 call to actions to highlight key documentation or tutorials.

Here’s the view definition.
1# apphome.view
2description: "Home page"
3schema:
4 properties:
5 bodyText:
6 type: string
7 required: true
8 headerText:
9 type: string
10 defaultValue: "Welcome Home"
11components:
12 - definition: home
13 properties:
14 title: "Sample Home"
15 components:
16 - definition: header
17 properties:
18 text: "{!view.properties.headerText}"
19 - definition: section
20 properties:
21 text: "{!view.properties.bodyText}"
22 - definition: actions
23 components:
24 - definition: button
25 properties:
26 name: "my_button"
27 label: "Take a Tour"
28 value: "take_tour"
29 events:
30 onclick:
31 definition: "apex__action__TakeTour"When a user opens App Home, the app_home_opened event is triggered. To onboard users on how to use your app, handle the app_home_opened event.
This Apex class responds to the app_home_opened event by publishing apphome.view.
1/* Publish apphome.view using Slack.EventDispatcher */
2public class AppHomeOpened extends Slack.EventDispatcher {
3
4 public override Slack.ActionHandler invoke(Slack.EventParameters parameters, Slack.RequestContext context) {
5 return Slack.ActionHandler.ack(new Handler(parameters, context));
6 }
7
8 public class Handler implements Slack.RunnableHandler {
9
10 Slack.EventParameters parameters;
11 Slack.RequestContext context;
12
13 public Handler (Slack.EventParameters parameters, Slack.RequestContext context){
14 this.parameters = parameters;
15 this.context = context;
16 }
17
18 public void run () {
19 // Gets the IntroSlackApp.slackapp app definition
20 Slack.App app = Slack.App.IntroSlackApp.get();
21 Slack.BotClient botClient = app.getBotClientForTeam(context.getTeamId());
22 // Gets the userId
23 String event = String.valueOf(parameters.getEvent());
24 String userId = event.substringBetween('user=', ',');
25 // Gets the apphome view and publish it
26 Slack.ViewReference viewReference = Slack.View.apphome.get();
27 viewReference.setParameter('headerText', 'Introduction');
28 viewReference.setParameter('bodyText', 'Introduce your app with a value proposition. Display 1-2 maximum call to actions that demonstrate key documentation and tutorials. Hands-on walkthroughs and tutorials to get folks using your app right away are preferred.');
29 Slack.HomeView homeView = new Slack.HomeView.builder()
30 .viewReference(viewReference)
31 .build();
32
33 Slack.ViewsPublishRequest req = new Slack.ViewsPublishRequest.builder()
34 .userId(userId)
35 .view(homeView)
36 .build();
37
38 Slack.ViewsPublishResponse response = botClient.ViewsPublish(req);
39 if(response.getError() != null) {
40 System.debug(response.getError());
41 }
42 }
43 }
44}List 1-3 common actions for users to perform.

Here’s the view definition.
1description: "Common Actions Example"
2components:
3 - definition: modal
4 properties:
5 title: "Getting Started"
6 components:
7 - definition: header
8 name: "basics"
9 properties:
10 text: "Basics"
11 - definition: section
12 properties:
13 text: "Describe what this slash command does"
14 - definition: section
15 properties:
16 text:
17 type: "mrkdwn"
18 text: "`/slashcommand1`"
19 - definition: header
20 name: "shortcuts"
21 properties:
22 text: "Shortcuts"
23 - definition: actions
24 name: "run_shortcut"
25 components:
26 - definition: button
27 properties:
28 label: "Run Shortcut"
29 style: "primary"
30 name: "run_shortcut_button"
31 events:
32 onclick:
33 definition: "apex__action__DoSomething"Display help, documentation, videos, or tutorials for deeper features that might navigate a user outside of Slack. Provide a feedback link to enable customers to easily send their feedback about the app.

Here’s the view definition.
1description: "Help & Feedback Example for App Home"
2components:
3 - definition: home
4 properties:
5 title: "Sample Home"
6 components:
7 - definition: header
8 properties:
9 text: "Help & Feedback"
10 - definition: section
11 properties:
12 text:
13 type: "mrkdwn"
14 text: "• <https://trailhead.salesforce.com/trailblazer-community/groups/0F94S000000kGtASAU|Apex SDK for Slack (UISF Apex) Trailblazer Community> \n • <https://developer.salesforce.com/blogs/2021/09/introducing-foyer-native-slack-integration-for-the-salesforce-platform | Introducing Foyer — Native Slack Integration for the Salesforce Platform> "
15 disableEncoding: trueSee the markdwn text type.
Additionally, you can list an overview for common tasks to be done within your app. Define a default view that leans towards showing active or relevant items. List all personal settings for your app including connecting to Salesforce, managing notifications, and other preferences.

Beta Feature