How to use Zapier Webhooks and Freshsales API to automate and integrate your business apps—Detailed Examples

Before we get started, I’d like to let you know that this isn’t for the faint of heart, we will be getting technical. I have tried to simplify it as much as possible, and if you stick around till the end I provide a copy and paste cheat sheet to automate your manual tasks with the Freshsales and Zapier integration.

I will be providing thorough, real-life examples to help you understand exactly how this works, as well as some nuances of automation.

Note: I do recommend checking the Freshworks Marketplace for an existing integration before worrying about creating your own with Zapier.

Glossary:

  • API: An API is a software intermediary that allows two applications to talk to each other. In other words, an API is the messenger that delivers your request to the provider that you’re requesting it from and then delivers the response back to you.
  • Webhooks: Webhooks are automated messages sent from apps when something happens. They have a message—or payload—and are sent to a unique URL to be processed.

Quick Navigation:

  1. Getting started
  2. Send information out of Freshsales using webhooks
  3. Send information into Freshsales using API and Webhooks by Zapier
  4. Using Freshsales API to find leads/contacts/deals
  5. Cheatsheet for using Webhooks by Zapier and Freshsales API
  6. Alternative solutions and use cases
  7. How to automate your entire business with Freshsales and Zapier – Webinar Recording

Getting started with Webhooks by Zapier and the Freshsales API

First off, how do we even begin to use the Freshsales API with Zapier? Quite simply, we’ll use Webhooks by Zapier and Freshsales Workflows. 

Webhooks are a very powerful tool that enable you to not only send whatever information you want into Freshsales (via the API) but they also allow you to extract any information you want to then manipulate or send to another platform.

Let’s start with the simpler of the two, sending information out of Freshsales to Zapier using webhooks and workflows.

Here’s a list of the tools and documentation you’ll need to get started.

  1. Freshsales account
  2. Zapier account
  3. Freshsales API documentation
  4. Webhooks by Zapier
  5. Freshsales workflows 

How to send information from Freshsales to Zapier using workflows and webhooks

Often you’ll want to send information from Freshsales to another system automatically. For most cases, Zapier has a supported “trigger” that makes this easy. But what do you do when there isn’t a supported trigger such as “Update Deal.”

For instance, let’s say you want to automatically create an invoice for a client once their deal reaches the stage “Accepted.”

Example: Automatically create an invoice on an updated deal stage

You can really do this with whichever invoicing or accounting tool you use, but depending on what you use, you may need to do some additional integration. 

Note: the Freshsales Marketplace is a great place to look for already existing integrations. For instance, they have a QBO integration.

Step 1: Setup a Zap with Webhooks by Zapier and “Catch Hook” as the trigger

Set up a Zap with webhooks by Zapier - Freshsales

Step 2: Copy the webhook URL

Copy webhook url - Zapier - Freshsales

Step 3: Create a deal workflow in Freshsales, specify the trigger and select “Trigger Webhook” as the action

Workflow in Freshsales with "trigger Webhook" as action

Step 4: Paste the webhook URL, select the data you want to send along, click to test, and then save and turn on the workflow

Pro-tip: Send along the deal ID and attach it to the invoice so you can easily update the appropriate deal later on in the process.

Test and initiate workflow on Freshsales

Step 5: Return to Zapier and pull in sample data to proceed with the workflow

Return to Zapier and pull in sample data to proceed with the Freshsales workflow

Step 6: If the deal doesn’t contain all of the related contact information, you will want to find the contact in Freshsales using the email address or API search function (covered later)

Find contact in Freshsales using email address

Final Steps

After you have the initial part setup, it’s all about passing this information into the invoicing tool of your choice. For my example, using Invoice Ninja, I first create a client and then I create an invoice.

It’s important to note that I associate the deal ID with both the client and the invoice so that I can reference the associated deals easily when the workflow is being triggered elsewhere than Freshsales.

Associate deal ID with client and invoice to refer to when workflow is triggered in Freshsales

How to send information to Freshsales using API and Webhooks 

You may find yourself wanting to make updates inside of Freshsales but Zapier doesn’t have a supported action.

Examples include:

  1. Updating deal information for a paid invoice
  2. Creating a calendar event when a deal is updated
  3. Logging calls
  4. Attaching files

In these cases, you must resort to using the Freshsales API. This can seem daunting, but if you stick with me you’ll see it’s really quite simple.

To continue with our previous example, let’s say you want to automatically update a deal in Freshsales after an invoice for that deal has been paid. And then you want to take the information associated with that deal and add an event to your calendar to remind you to collect the last payment installment (or something else..)

[Part 1] Example: Automatically update Freshsales deal upon successful invoice payment

Continuing with the initial example, I will be using Invoice Ninja as the invoicing tool. Except this time I will be using Invoice Ninja as the trigger inside of Zapier and then sending information into Freshsales using API and Webhooks by Zapier.

Note: the Freshsales Marketplace is a great place to look for already existing integrations. For instance, they have a QBO integration.

Step 1: Set up your Zap to trigger a new invoice payment and retrieve the invoice details
In my case, I need to add a second step to my zap that finds the invoice associated with the payment because the information pulled in from the trigger does not contain all that I need to identify the deal in Freshsales.

Do you remember the pro-tip? So hopefully you passed along the deal ID as a field on either the invoice or the client, because you’re going to need it. To get the ID you’ll need to retrieve it from the invoice that has been paid or do a search for the client associated with the invoice to retrieve the ID from their profile.

I passed my deal ID in as a “private note” on the invoice.

Don’t have the deal ID? No worries, if you scroll to the bottom of the article I’ll show you how to perform an API search using information like phone number, email, name, etc.

Set up your Zap to trigger a new invoice payment and retrieve the invoice details

Step 2: Perform any data formatting or steps you need, then make a PUT request to the Freshsales API using Webhooks by Zapier

This is kind of a long step, so bear with me.

So the way I know to use a PUT instead of a POST or GET is because I went to the Freshsales API documentation and looked at what they require under “Update A Deal.”

Update a deal using Freshsales API documentation

Before you edit the Zapier template you’ll want to know a few things:

  • URL: 
    • https://YOURDOMAIN.freshsales.io/api/deals/DEALID
  • Payload Type: 
    • Json
  • Data
    • This is the information you want to pass in or update inside of Freshsales
    • Formatting standard fields (copy exactly)
      • deal__ field_name
    • Formatting custom fields (copy exactly)
      • deal__custom_field__cf_field_name
  • Wrap Request in Array
    • No
  • File
    • Link to file you want to pass along
  • Unflatten
    • Yes
  • Basic Auth
    • USERNAME|PASSWORD
    • This works fine for most cases
  • Headers
    • This is where you can pass along your API token for authorization if you didn’t use Basic Auth.

Edit template - Freshsales - Zapier

You’ll notice that I’m pulling in the deal ID from the invoice and then I’m doing 3 things in the data section.

  1. deal__deal_stage_id 
    1. I’m updating the deal stag to move the deal further along in the pipeline
  2. deal__custom_field__cf_payment_status 
    1. I’m updating the payment status to “Deposit Made.”
      1. I know it’s a deposit vs a payment in full because of step number 3 in Zapier where I’m using a formula to compare the amount paid to the invoice total
  3. deal__custom_field__cf_amount_paid 
    1. I’m updating a custom field “amount paid” to the amount that has been paid on the invoice

[Part 2] Example: Retrieve deal information via Freshsales API to then create a Google Calendar event

Now we’ve updated the deal in Freshsales, but what if we also want to create a calendar event with the deal/contact information to remind us to collect the remainder of the payment (or for any reason).

In our example, we want to make a calendar event to remind us to charge the client the second half of an invoice that only had the deposit paid.

I have a filter step set up in Zapier to look if the invoice was paid in full or only had a deposit made. If it was paid in full, the zap does not proceed.

Step 1: Perform a GET request using Webhooks by Zapier to the Freshsales API to retrieve information associated with the deal

As we did in part 1 where we had to update the deal, this time we want to pull the information associated with the deal. To know to use a GET request, we look at the Freshsales API documentation.

Perform a GET request using Webhooks by Zapier to the Freshsales API to retrieve information associated with the deal

This time we don’t have to do anything except pass along the deal ID in the URL. Much simpler than updating the deal with the PUT request.

Once you test this step, you’ll be able to see all of the details associated with that deal. If everything looks good and you have the information you need, it’s time to proceed with creating the calendar event.

Test the step - Zapier and Freshsales

Step 2: Create a detailed Google Calendar event with Zapier

Pretty straightforward here, you’ll just want to pass in any data that is required/helpful for the calendar event. For this example, we’re passing through the customer name, the job type, the balance due, and the due date.

Detailed Google calendar event creation using Zapier integration into Freshsales

How to find leads/contacts/deals when you don’t have the ID by searching with the Freshsales API

As we’ve seen so far, there are many use cases that require sending information into Freshsales via their API. However, you may have noticed that to update a lead/contact/deal, you need to have the associated ID.

So what can you do if you don’t have the ID?

You can use the Search function of the API to locate the appropriate record by using other identifying information like phone number, email, name, etc.

For this next example, I’m going to show you how to log text messages from RingCentral as notes on a lead or contact profile using only the phone number.

To get started, we’re good to head over to the Search documentation on the Freshsales API documentation.

As you can see, we’re going to need to perform a GET request using Webhooks by Zapier.

Searching for leads/contacts/deals using Freshsales API

Example: Automatically log RingCentral text messages to a Freshsales lead and/or contact profiles

RingCentral’s integration with Zapier can trigger new text messages and the set up is straightforward. You can do this with other mobile services, I’ve used RingCentral as an example.

Step 1: Set up two Zaps, one for inbound messages and another for outbound messages

 

Text tracking

You can set up both inbound and outbound messages to be processed in a single zap, but I recommend using two because it’s more straightforward and allows you to troubleshoot errors easily.

You’re going to want to set the trigger as “New SMS” and then add a filter step that looks at the direction (inbound/outbound) of the message as well as a formatter step to format the phone number and make it easy for searching.


id=”Example-Logging-RingCentral-text-messages-as-notes”
Setting up inbound and outbound messages in Zap

Step 2: Perform a GET request to search via the Freshsales API

Now you’re going to use Webhooks by Zapier to perform a GET request to the Freshsales API to search leads based on phone number.

The URL and parameters are as follow:

  • https://YOURDOMAIN.freshsales.io/api/search?q=PHONENUMBER&include=lead
  • The information after “q=” is what you are searching by
  • After “include=” you’ll put either lead, contact, deal, sales_account and this is what you are searching for

Perform a GET request to search via the Freshsales API

Step 3: Use a Path to account for texts from both leads and contacts

It may have occurred to you that both leads and contacts send messages and if you’re only searching for leads you’ll fail to record text messages for contacts.

The solution is to set up a Path within Zapier that looks at the results of the initial GET step. If the search is successful an ID will be returned for the lead. If it is not, there will not be an ID.

What you will do is have one path proceed if ID exists and the other proceed if it does not exist.

Use a Path to account for texts from both leads and contacts - Zapier - Freshsales

 

If the lead does exist, then proceed with adding a note to the lead. If the lead does not exist, then proceed with performing a new GET request where you’re searching for contacts instead of leads.

 

Then, the last step, add the note to the lead or contact. You can do this using Zapier and Freshsales supported actions.

Add note to lead or contact using Freshsales or Zapier supported actions

Cheatsheet for using Webhooks by Zapier and the Freshsales API

I’ve pulled together a little cheat sheet to help you along the way. If you’d like the entire document or you’d like to ask me questions, please email me at rob@alice.design. 

API Cheat Sheet

Alternative solutions and use cases

What if I told you there was an easier way to interface with the Freshsales API than by using Webhook by Zapier?

You’d probably wonder why I didn’t just start with that.. and good question. Maybe I like to save the best for last?

Actually, the reason I held off on telling you about the Integromat integration with Freshsales is because you’re likely to find more apps you want to integrate with Freshsales that are supported by Zapier.

Integromat is a great tool, it just doesn’t have as many integrations as Zapier (yet), and it also can be more difficult for automation beginners to use.

What is really awesome is you can integrate Zapier and Integromat to take your automations to the next level. Each tool has its strengths and being able to use them seamlessly together, is AWESOME!

The integration between Zapier and Integromat is handled via webhooks, so it’s very useful to have learned how to use webhooks in this article ☺

You can pretty much automate anything by using tools like Zapier and Integromat, I encourage you to try your hand at solving simple, mundane tasks in your business, and then move onto tackling larger problems. Also, don’t forget, we are all here to support you.

Happy automating!

7. How to automate your entire business with Freshsales and Zapier – Webinar Recording

Cover illustration by Ashna Liza Sunny