Celebrating Success at Scale: How We Built Our Salesforce Slackbot
Tags: featured, engineering
Published: 2018-09-07 00:15:09

---
title: Celebrating Success at Scale: How We Built Our Salesforce Slackbot
published: True 
tags: Featured,engineering
canonical_url: https://www.nylas.com/blog/celebrating-success-at-scale-how-we-built-our-salesforce-slackbot
---

[![Celebrating Success at Scale: How We Built Our Salesforce Slackbot](https://www.nylas.com/hubfs/blog%20images/SlackBotCommunity.png?t=1536268959146) ](https://www.nylas.com/blog/celebrating-success-at-scale-how-we-built-our-salesforce-slackbot)

<p>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.</p>

<p>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.</p>
<p>&nbsp;</p>
<div><img src="https://cdn2.hubspot.net/hubfs/3314308/slackbot-screenshot-edited.png" alt="nylas-salesforce-slackbot-screenshot" width="478" style="width: 478px;"></div>
<h2 style="text-align: left;"><strong>Getting rid of the sales gong</strong></h2>
<p>If a sales gong rings, and no one is around to hear it, does it make a difference? Probably not.</p>
<p>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.</p>
<p>We built a Slackbot to do what a sales gong can’t -- keep everyone in the loop in real time.</p>
<h2 style="text-align: left;"><strong>How the Slackbot helps push Nylas forward </strong></h2>
<p><span>Having just</span><span>&nbsp;</span><a href="https://www.nylas.com/blog/announcing-our-16m-series-b">closed a $16M Series B round</a><span>&nbsp;</span><span>lead by</span><span>&nbsp;</span><a href="http://www.sparkcapital.com/">Spark Capital</a><span>, we are continuing to grow our team to better serve our rapidly growing customer list.</span><span>&nbsp;(</span><a href="https://www.nylas.com/jobs/">Check out our open positions here</a><span>&nbsp;</span><span>to apply. When you join, get ready to up your celebratory Slack-moji game.)</span></p>
<p><span>An expanding team makes it even more important to have good communication and transparency into our shared successes as a company.</span></p>
<p><span>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.</span></p>
<p><span>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.</span></p>
<h2 style="text-align: left;"><strong>How to build your own Salesforce-powered Slackbot</strong></h2>
<p>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.</p>
<h2 style="text-align: left;"><strong>Setting up your Slack environment</strong></h2>
<p><span>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.</span></p>
<p>Next, you’re going to <a href="https://api.slack.com/slack-apps#creating_apps"><span style="font-weight: 400;">create a Slack app</span> </a>and authenticate it by entering in your organization’s Slack credentials.</p>
<p>&nbsp;</p>
<div><img src="https://cdn2.hubspot.net/hubfs/3314308/Screen%20Shot%202018-09-06%20at%2011.58.49%20AM.png" alt="Screen Shot 2018-09-06 at 11.58.49 AM"></div>
<p>&nbsp;</p>
<p><span>Now, we have Slack channel for our Salesforce updates and&nbsp;</span><span>a Slack app to do the updating</span><span>. But we still need to get Slack and Salesforce to talk to each other.</span></p>
<p><span>To do that,&nbsp;</span><a href="https://api.slack.com/incoming-webhooks">create an incoming webhook</a><span>&nbsp;for your Slack test channel. This will allow&nbsp;</span><span>Salesforce</span><span>&nbsp;to send information to Slack so Slack can take action accordingly.</span></p>
<h2 style="text-align: left;"><strong>Setting up your Salesforce environment</strong></h2>
<p><span>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&nbsp;</span><a href="https://www.linkedin.com/pulse/slack-salesforce-notify-closedwon-deals-tuan-abdeen-/">a great LinkedIn post</a><span>&nbsp;which features the ins and outs of this step.</span></p>
<p>Once you’ve set the class to send a message to the test webhook in Slack, we’ll need to create a workflow in <a href="https://help.salesforce.com/articleView?id=process_overview.htm">Process Builder</a>.</p>
<p><span>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.</span></p>
<p><span>Once you’ve created the event and the action in Process Builder, activate the process and we’re off to the races.</span></p>
<h2 style="text-align: left;"><strong style="color: #0d2b29; font-size: 22px; background-color: transparent;">Testing your Slackbot</strong></h2>
<p><span>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. </span></p>
<p><span>Now, lets bring these alerts to the big time -- the #general channel.</span></p>
<h2 style="text-align: left;"><strong style="color: #0d2b29; font-size: 22px; background-color: transparent;">Bringing it all&nbsp;together</strong></h2>
<p><span>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.</span></p>
<p><span>After that, it’s time to sit back and get ready to celebrate. 🎉</span></p>
<p>&nbsp;</p>