How to use Salesforce Outbound Messages & Zapier to celebrate a closed won sale in HipChat 💸 🎉

I’ve always found Zapier to be a cool tool, but never thought of an application to use it at Industry Dive. My colleague had set up a few Zaps between Google Sheets & Salesforce and had showed me the gist of Zapier, which got my wheels turning.

Then, this happened in our sales chat:

I mean, #duh.

image

Spoiler Alert: This post is not about how I managed to get specific songs to play from Spotify to Sonos. We’re still using a human for that part of the equation — but if you have ideas, let me know in the comments! 🎵

We quickly polled the sales team to get everyone’s favorite song. Given that we didn’t want complete chaos on the Sonos we decided to limit playing a rep’s song to closed won deals over $15,000. This happens just infrequently enough that it would be special.

So here is where Zapier comes in: How could we notify the team in our HipChat room the second a deal was closed that met that criteria? A simple Workflow Rule in Salesforce would allow me to email the team, but a HipChat is exponentially more fun. 💬

Assumptions

Before following the below instructions, make sure you have the following or else you’ll just get frustrated.

A paid subscription to Zapier. Salesforce is a “premium” application which means you can’t access it on Zapier’s free plan.A System Admin profile or Modify All Data permissions in Salesforce. Or, just send this to your friendly Salesforce admin, I’m sure she’d be happy to set this up for you. ☁️Ability to get the an Admin Auth Token from HipChat. This is what Zapier uses to “call” HipChat and access the HipChat room you want to message. This was the piece of the puzzle I didn’t have access to so I just hunted down one of our HipChat admins, asked them the generate the token and then send to me.

Step 1: Open up Salesforce & Zapier and set up the Outbound Message

If you have dual monitors, this will make it a lot easier so that you can flip between the two apps.

In Zapier create a new Zap and select Salesforce then type in “Outbound” into the Salesforce Trigger search. You’ll then be asked to connect your Salesforce instance to Zapier, so go ahead and do that if you haven’t already.

image

The next step will be to get this webhook, which is what allows Salesforce and Zapier to “talk.” Keep this page open and switch to a new tab to Salesforce.

In Salesforce, create an Outbound Message. The object you’ll want to create it on is Opportunity, because that where closed won sales happen! But you can see you can create an Outbound Message on almost any object.

Put the URL from the Zapier screen above into the Endpoint URL field in Salesforce.

image

The “Opportunity fields to send” section is important because that is the information you are sending back to Zapier, which will ultimately become part of the message you send to HipChat.

Side note: You’ll see that Account Name and Owner Name aren’t available options to pull over. This is why I’m bringing the IDs. We’ll convert them over to text in a later step.

Once you do this press Save on the Salesforce screen and save on Zapier. At this point, Zapier will want to pull in examples using the webhook you just added.

You’ll get something like this:

Allll the Salesforce IDs. 🔢

image

Step 2: Go back to Salesforce and set up a Workflow Rule

The Outbound Message is what sends all the relevant information to Zapier but something needs to kick off the Outbound Message. An Outbound Message on its own does nothing. Enter: Workflow Rule!

Create a new Workflow Rule that has the criteria you want to trigger to the Outbound Message. My criteria is fairly simple: Closed Won & over $15K.

image

Once you save your Workflow Rule, make sure to add an Immediate Workflow Action (choose: New Outbound Message) which is triggering your Outbound Message. Basically, you’re linking the two actions together. Otherwise, nothing will happen!

💡Admin Best Practice Side Note: I named both my Outbound Message and Workflow Rule “Over $15K for Zapier.” I also utilized the description field to explain what these actions do. When you’re stringing together different components within the system naming consistency is helpful because it shows you (and future admins!) that all these parts are related.

Before we delve into Step 3, let’s briefly cover what we did:

Set up an Outbound Message from Salesforce to Zapier, which sends the relevant data from Salesforce to Zapier (which will eventually be passed to HipChat).Set up a Workflow Rule to push that information out of Salesforce based on specific criteria (since I don’t want to send a HipChat for every single sale!)

Next Steps: Use the IDs from the Outbound Message to get the text you want to include in your HipChat

This really puzzled me initially. In the screenshot above with all the Salesforce IDs you’ll note that that the only thing that is legible is the amount: 5000.00. Everything else is in Salesforce ID form. But when you go to set up your Outbound Message you don’t see an option to select “Account” just “Account ID.” Hmm. 🤔

So at first I just ignored this and plowed straight ahead into the HipChat portion of the Zap. This is what I got:

Yike.

image

Okay, fine. I should probably figure out a more legible solution. At this point I hadn’t thought to read Zapier documentation, so I just turned to Twitter instead.

Initially I thought I’d create formula fields that would be hidden on the page layout in Salesforce so that I could pull the information over to Zapier. My heart secretly ached at the idea of creating extra fields for such a silly purpose. But then! A response!

Brilliant! Instead of creating these fields, I would just create steps in Zapier to search for the information I wanted in Salesforce and then bring it back to Zapier in the format that I wanted. I had to create a lot more steps in Zapier, but this way everything was self-contained in Zapier and I wasn’t spinning up random fields in Salesforce.

It does seem a little circular; you just called all this information from Salesforce to Zapier and now you’re sending it back to Salesforce just for the purpose of reformatting it. But since you only have IDs for these objects and nothing more, you need to query Salesforce so you can get all the fields so your HipChat message isn’t gibberish.

Step 3: Find Account

In Zapier, create a new step after your Outbound Message. Select Action, then Salesforce, and then “Find an Account.”

You’re searching by the Account ID you got in Step 1!

image

Select Account ID and then Notification S Object Account ID. Then follow the rest of the prompts.

Don’t worry about Account Name and other text yet! That will come later.

Step 4: Find User

This is pretty much the same as above, but instead of “Find an Account” you’ll choose “Find a Custom Object.” The User object is not a Custom Object, but that’s what Zapier calls anything that they don’t have in their system.

This is the User ID for the Opportunity Owner and how you’ll get their name.

image

This is what your steps in Zapier should look like so far:

image

Step 5: Format Currency

This is 100% optional but if you’re going to do a job you might as well do it well, right? In your Outbound Message Salesforce gives you the amount of the opportunity in this format: 50000.00. No dollar sign, no comma. Not ideal.💰

Luckily, Zapier has a solution for this called “Formatter” that will transform the number for you. Create a new Action and search for Formatter. Choose Numbers and on the next screen you’ll be presented with this:

The Currency Format part still confuses me a bit.

image

Your input is the amount that came over in the Outbound Message.

You’ll then get an option to test the results of the formatting. If it doesn’t look how you want it, go back to the previous screen and fiddle with the Currency Format options until you get what you want.

Step 6: String it all together to create your HipChat message! 💃

Okay, you’ve told Salesforce to send information to Zapier, you’ve searched Salesforce for the correct information you want to render in your chat and you reformatted the currency because you’re an overachiever. 💅 Let’s finally put it all together and send a HipChat message!

Back to Zapier: Create a new action, search for HipChat, and select “Send Message.”

You’ll need to connect HipChat and Zapier so this is where that Admin Auth Token will come in handy. Grab that and you’re ready to rock and roll.

Next comes the fun part: Setting up the template!

image

Room: The HipChat room you want to send the message to (when you are first setting this up and testing it, I recommend making a private room or sending the chats to a less populated room.)

From: This is just a free form text field and you can make it whatever you want. I thought Opportunity Bot was cute so that’s what I went with. 🤖 (Too bad I can’t add emojis in Zapier/HipChat because otherwise I totally would)

Message: Here is the what we all came for and the purpose of all those darn searches. You can now craft your message and pull information from each search step.

Basically an elaborate mail merge. 📩

image

I just wanted account name and user name but because you pulled in the entirety of the Account and User objects, you could pull in whatever you want — user title or maybe account phone? Really, the possibilities are endless.

Notify, Color, and Format: All pretty straight forward — make the choice that is right for you.

Before going live, I recommend sending a couple tests to a test HipChat room to make sure your chat is exactly how you want it.

Once you’re happy, change the HipChat room to real room you want to send the chats to and don’t forget to turn on your Zap!

Step 7: Wait for the sales to roll in

End of quarter sales has the Opportunity Bot working overtime. 😅

image

The best part of the Outbound Message is that it’s instantaneous! This is because Salesforce is pushing information to Zapier vs. asking Zapier to search your Salesforce instance. So the second a rep closes a deal, you’ll see it in HipChat.

Did you try this? Or have an idea on how it could be better? Leave a comment below or find me on Twitter. I’m always looking to meet other Salesforce enthusiasts. ☁️