Essentially as workforce is becoming remote and asynchronous, communication tools like Slack is increasingly becoming popular for connecting enterprises. An enterprise uses many applications but can Slack play the role of a hub where power users uses shortcuts to read and write data into applications without leaving slack and at the same time communicate with peers using slack ? The answer is "Yes"

What it does

With the above in mind, what I created is a slack app where corporate inside sales organization can update an opportunity record in salesforce by updating the Stage field to "Closed Won" which will automatically push a slack notification in a slack channel and all field sales rep and anyone in the channel can view it.

At the same time when outside (field) sales rep are on the move they can query and write salesforce data using slack shortcuts. A sales rep can use a

/contact FirstName LastName Email Phone

to quickly create a contact in salesforce, also use another shortcut

/account SearchString 

to query Account object in salesforce

How we built it

Artifacts in Slack:

  1. Created a slack app with manifest file.
  2. Installed it in a workspace
  3. Defined OAuth & Permissions (token)
  4. Interactivity & Shortcuts for user acknowledgement of certain verbiage - Listen to a word and send interactions to the channel
  5. Incoming Webhooks - To push data to a slack channel
  6. Slash Commands - To read and write data into salesforce app

Artifacts in salesforce:

  1. Flow
  2. Apex

There are 2 scenarios to the project


  1. Salesforce -> Slack (When an opportunity stage is updated to "Closed - Won) I created a salesforce Record Triggered flow on condition that "StageName" = "Closed Won", then it would call an salesforce apex which makes a http callout to incoming webhook of slack to push a message with the opportunity details in a channel

  2. Slack <-> Salesforce I used Glitch to create a fastify middleware and jsforce library to auth and CRUD in salesforce along with endpoints which are defined in Slash Commands Result of commands in slack

Account Search : Response from salesforce {"searchRecords":[{"attributes":{"type":"Account","url":"/services/data/v42.0/sobjects/Account/0018c000028Gl16AAC"},"Id":"0018c000028Gl16AAC","Name":"Grand Hotels & Resorts Ltd"}]}
Contact creation: Response from salesforce {"id":"0038c00002dHtH0AAK","success":true,"errors":[]}

Glitch URL mentioned below: rambunctious-sneaky-pail - For interactions Glitch URL mentioned below: astonishing-pinto-arrhinceratops - For salesforce and slack interactions (fastify middleware)

Challenges we ran into

There were not many challenges to document, it was fairly easy to post to slack using incoming webhook and after authenticating salesforce in fastify middleware it was easy to communicate back and forth between salesforce and slack. It was also quite easy to listen to a certain word and interact with the user. Code URL attached

Accomplishments that we're proud of

With the above solution Slack truly is a corporate digital tool for entire enterprise to use, I made it an extension of salesforce application at the same time utilize the power of all of its features.

What we learned

I learnt how to build a slack app and orchestrate with enterprise apps

What's next for Call Report

This is just the beginning, I would like to extend it for any app that can speak REST API. Imagine health care professions who are always on the move communicating (with enterprise app) using slack. The same could be true for truck drivers updating location and so many other use cases, it could be even customers sending important information to another entity.

Built With

Share this project: