No comments yet

Slack Apps with Apex on Salesforce

Slack has traditionally been associated more with non-Salesforce backends such as AWS. Now that Slack is a Salesforce product, Salesforce developers are probably curious about what is like to develop Slack apps. Good news! Salesforce is a wonderful backend for building Slack Apps! This post will show you how you can use your existing, Salesforce skills to build Slack-first apps that will delight users.

Salesforce is a good platform for building many Slack apps on. We will talk about include concepts such as security, surfaces, interactions, and an overview of the various Slack APIs.

Transferable skills

Salesforce has a database and Apex, as well as APIs but Slack just has APIs.

Similarities between Apex and Slack

  1. Slack Web API / Salesforce REST API
  2. Slack bots / Service Account in Salesforce (integration user)
  3. Slack Events API / Salesforce Platform events
  4. Workspace / Dev org
  5. Global, message shortcuts / Global quick actions, object quick actions
  6. Block Kit / Lightning Base Components

Slack APIs for Salesforce

  1. 🛑 RTM API (WebSocket, older, doesn’t support some of the new rich features)
  2. 🛑 Socket Mode (WebSocket for Web API / Interactivity)
  3. 🟡 Slack Incoming Webhooks (old school, simple)
  4. ✅ Events API over HTTP (Slack calls your endpoint)
  5. ✅ Slack Web API

Surfaces (ways your app can present to the user)

  1. App Home Tab
  2. Modals (Block Kit)
  3. Messages (text or Block Kit)

Slack Events

  1. Passive way to do things similar to Interactivity.
  2. New user joins a channel
  3. User deletes a message
  4. User adds emoji reaction
  5. User sends a message

Security

Think of endpoint URLs like password.  Long and strong.  We get 2 or 3 chances with a URL! Token verification or signature verification. Grant proper guest access to platform events and Apex Classes.

Demo

Summary

Now we understand how to build Slack Apps with Apex on Salesforce. Check this repo for complete code used in demo.

Post a comment