I’m excited that Slack is now part of Salesforce. This is partly due to an often overwhelming daily deluge of email, and partly because my first taste of the internet was through IRC (or Internet Relay Chat). That’s why I’ve always preferred asynchronous-but-often-instant communication tools. Now that Slack and Salesforce are completely integrated, well, the sky’s the limit! I can use shortcuts to create and update records — all within Slack.

But there’s so much more we can do with Slack and Salesforce. Every Thursday in December, Mohith Shrivastava (@msrivastav13) and I (@codefriar) are going to #codeLive a travel approval app. Join us on December 2nd for the first of four episodes! We’ve got a lot to cover in each one, so this blog post will introduce our starting point.

Background and overview of Slack integrations

When Slack and Salesforce officially joined forces in July, Mo wrote a great blog post about Slack for Salesforce developers. I want to encourage you to give it a read! It’s an excellent foundation for what’s possible, and much of what we do on #codeLive will build on it. There are many options to choose from when building a Slack ↔ Salesforce integration, and your app’s functionality needs to drive which integration tool you use to build it. Mo’s post has a great walk through of the options.

We also recently announced Foyer, which is a set of developer tools that delivers all the plumbing needed to create a Slack app using your existing Salesforce skills. Foyer is currently in Pilot for our ISV partners. Be sure to check back regularly for announcements on future milestones.

For now — and for teams who’s business needs require them to build it themselves — our option is the Bolt SDK. Bolt is a collection of three language-specific SDKs: JavaScript, Python, and Java. Each framework provides an idiomatic implementation of the SDK. While you can host your Bolt middleware anywhere, we’ll host ours on Heroku.

An architecture diagram showing Slack communicating bidirectionally with your Bolt app, which also bidirectionally communicates with your Salesforce org

For a Bolt-based Slack ↔ Salesforce integration, you’ll need to take the following high-level steps:

  1. Create a Slack app on api.slack.com/apps.
  2. Install the app within your Slack workspace.
  3. Develop and deploy your Bolt SDK middleware.
  4. Authenticate and authorize from Bolt to your Salesforce org.
  5. Use your app!

If you’ve built a Slack ↔ Salesforce integration already, you likely familiar with those steps. If you need, or want, to build a custom Bolt-based integration, we’ve got something to show you!

Salesforce-Slack starter kit

Most corporations I know have some sort of process for approving travel, and quite a few (including Salesforce!) have created Salesforce-based travel approval apps. But we can do one better. We want users to interact with the app in Slack, but our data will be in Salesforce. That’s a tall order for four episodes of #codeLive. To set us up for success, we decided to do some pre-work.

To get us started, Mo and Alba Rivas created a delightful Slack ↔ Salesforce development starter kit. You can find the code over at Github.

What does the starter kit do?

Pretty much every integration project that I’ve ever been part of has had a ton of setup, including detail work like creating and installing keys, certificates, and metadata. The devil, as they say, is in the details. Copy/pasting things is easy to get wrong and hard to debug if you’re mostly successful. Worse yet, it’s easy to get configuration functional but insecure. The starter kit works to automate much of this detail work for you!

Convention over configuration

The starter kit simplifies things by providing bootstraps and using convention over configuration. For example, it provides a bootstrap version of manifest.yml, and this file bootstraps Slack’s understanding of what your application does. The starter kit also provides a deploy script, which utilizes Heroku and Heroku conventions — like environment variables — to reduce configuration complexity. Furthermore, the deploy script handles the creation of the connected app metadata.

If you follow the Readme’s instructions, you’ll be set. You’ll have a Slack app defined in your workspace, and you’ll have a scratch org set up with a connected app. The connected app facilitates the use of JWT auth to Salesforce, and because of the auth into your org, the middleware can interact with Salesforce APIs.

What doesn’t the starter kit do?

At this point, the starter kit does a lot for you, but it doesn’t do everything. There are, for instance, a couple of manual steps that you’ll have to do, such as copy/pasting the manifest.yml file into Slack’s new app form and pushing metadata. Also, the starter kit only offers username and password or JWT-based auth. It’s connecting to Salesforce as a single user, and this integration user handles all Salesforce data manipulations. This means that if Susan takes action in Slack, Salesforce will list the integration user – not Susan, as having taken action.

Progressive enhancement

At this point you’ll have a bare minimum Bolt app — after all, it is a starter kit. This December, Mo and I will be enhancing the app every Thursday on codeLive. Over the course of four episodes, we’ll build our Travel Approval app focusing on:

  1. Salesforce backed, per-user auth
  2. Using Block Kit to build out user interfaces and forms
  3. Submitting and processing Salesforce approval processes, and interacting with Salesforce data
  4. Local development and (inevitably) debugging

If you’re wanting to get started from scratch, Mo created a great quick-start video that leads you through these high-level steps in detail.

Conclusion

I’m excited to dig into Slack development, and we’ve got a great starter kit and a fun use case to solve for. Couldn’t join us for the live sessions? Thats ok, we recorded them! You can check them out here.

About the author

public with sharing KevinPoorman {
public static String pronouns = 'he/him';
public static Double startedWithSalesforceAtApiLevel = 11.0;
public static String[] interests = ['Apex', 'Testing', 'iOS SDK', 'Generics', 'Metaprogramming'];
public static String funFact = 'Has two daughters he\'s training to take over the world.';
public static String twitterHandle = '@Codefriar';
}

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS