Celebrating Success at Scale: How We Built Our Salesforce Slackbot

Kevin Fayle - Sep 7 '18 - - Dev Community

Celebrating Success at Scale: How We Built Our Salesforce Slackbot

The Nylas API handles more than 100 million API requests per day for customers ranging from up-and-coming startups to Fortune 100 companies. This wouldn’t be possible without a close-knit team that not only works hard together, but celebrates success together.

That can be hard to do at a fast-paced company, especially with offices on both coasts. But, with a little bit of code and a few APIs, we wired up a Slackbot that gives every employee real-time visibility into new customers joining the Nylas community.

 

nylas-salesforce-slackbot-screenshot

Getting rid of the sales gong

If a sales gong rings, and no one is around to hear it, does it make a difference? Probably not.

Cohesion and transparency are essential to building a productive, happy team. Nylas has team members in New York, San Francisco and abroad. So, no matter how hard we hit a sales gong, odds are not every employee would hear it.

We built a Slackbot to do what a sales gong can’t -- keep everyone in the loop in real time.

How the Slackbot helps push Nylas forward

Having just closed a $16M Series B round lead by Spark Capital, we are continuing to grow our team to better serve our rapidly growing customer list. (Check out our open positions here to apply. When you join, get ready to up your celebratory Slack-moji game.)

An expanding team makes it even more important to have good communication and transparency into our shared successes as a company.

The other side of that is that we wouldn’t be where we are today without our customers. Our Slackbot helps ensure everyone at Nylas - from our operations team to our engineers - recognizes our customers and feels the impact they have on our growth as a company.

Seeing the wide range of companies that have chosen Nylas to power their applications really gives the team a sense of pride in what we've built, and inspires us to continue providing an excellent customer experience into the future.

How to build your own Salesforce-powered Slackbot

To create our Slackbot, we connected our Salesforce instance to Slack and built a process in Salesforce to post in our #general channel whenever a Salesforce deal moves to “Closed - Won”. Now, we can all send 👏 emojis the moment a deal closes. Here’s how you can do the same.

Setting up your Slack environment

First, let’s make a new channel where we can test the bot we’ll be building. This ensures we won’t accidentally @here a popular channel when we're sending out test messages.

Next, you’re going to create a Slack app and authenticate it by entering in your organization’s Slack credentials.

 

Screen Shot 2018-09-06 at 11.58.49 AM

 

Now, we have Slack channel for our Salesforce updates and a Slack app to do the updating. But we still need to get Slack and Salesforce to talk to each other.

To do that, create an incoming webhook for your Slack test channel. This will allow Salesforce to send information to Slack so Slack can take action accordingly.

Setting up your Salesforce environment

Those Slack webhooks we set up are hungry for some Salesforce data. We’ll set up our Salesforce instance to deliver just that. Create an Apex class that collects data about the closed deal, builds the Slack message, and posts the message to the webhook address we’ve made in Slack. If you need some guidance here, Taun Abdeen wrote a great LinkedIn post which features the ins and outs of this step.

Once you’ve set the class to send a message to the test webhook in Slack, we’ll need to create a workflow in Process Builder.

The process we're building will take a certain action based on a certain event. Define the event in Process Builder as when an opportunity moves to “Closed - Won”. Next, create an action that collects data from the closed opportunity and passes it to the Apex class so it can create and post the Slack message.

Once you’ve created the event and the action in Process Builder, activate the process and we’re off to the races.

Testing your Slackbot

Once your Salesforce environment and Slack app are talking to each other, it’s time to test your bot. Try moving a demo opportunity to “Closed - Won”. You should see a message post in the test channel you’ve set up.

Now, lets bring these alerts to the big time -- the #general channel.

Bringing it all together

Finally, create a new webhook for your #general channel and change your Apex class so it posts to the webhook associated with #general as opposed to your test channel.

After that, it’s time to sit back and get ready to celebrate. 🎉

 

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player