***Please note that Integromat evolved into Make in February 2022. All content for Integromat is also valid for Make.***
The Problem
A client is running Pipedrive CRM + JustCall + CallRail combo:
- Leads are captured in Pipedrive.
- As soon as a call from an unknown number comes, a “deal” is automatically created in Pipedrive thanks to its native integration with JustCall.
- Calls not originating in PPC campaigns are simply hitting JustCall numbers directly.
- Calls coming from PPC campaigns are tracked via CallRail where the client can get detailed information about the source of the call – particularly all the parameters from your landing page URLs such as
- utm_source
- utm_medium
- utm_campaign
- keyword
- + many other parameters such as campaign id, adgroup/adset id which the client embeds into the landing page URLs.
The problem I was solving was this: How to get all the traffic source information from CallRail to the correct the deal in Pipedrive automatically so the intake team knows what the client searched on Google/Bing prior to making the call?
Technically speaking, I had to figure out how to pass all the URL parameters captured in CallRail into custom fields into the corresponding deal in Pipedrive while taking possible duplicates into account. And all of that needed to happen just via Integromat.
The Solution
I ended up creating a relatively simple scenario which starts with a basic webhook module. You could also make use of the CallRail webhook module but there is literally no difference whether you parse the incoming pings with the native Integromat webhook module or with the branded CallRail webhook module.
The event I am listening for is the “post-call event”. One could also listen for the “pre-call event”, however that payload will carry less information about the call.
There were 2 challenges in the project. And as always, they were about handling duplicates:
- What to do when there are 2 or more Pipedrive “persons” with the same phone number?
- What do to when one “person” has 2 or more deals in Pipedrive?
Let me explain further. Once the post-call webhook is received, I first need to “search” for the person in Pipedrive by the phone number which came from CallRail. Once I retrieve the person ID, only then I can look for all the the deal IDs associated with this person ID. So it is very much possible, the same person will exist twice in Pipedrive. It is also very much possible, the same person can have associated multiple deals.
I had to put a logic into place which handles these edge cases. I decided to always look for the “newest” person and her/his newest deal. For figuring the latest person ID, I used a neat trick with Numeric aggregator by selecting the max person ID. For finding the max deal ID, I simply used the nested formula below to get the max deal ID.
get(sort(map(body.data[]; "id"); "desc"); 1)
Once I retrieve the deal ID, I can finally use the “Update a deal” module and map the URL parameters from CallRail into custom fields in Pipedrive CRM. However, there was one more trickery needed – I had to figure out how to parse the parameters from the long URLs which also comes in the webhook payload. I ended up using nested formulas once again. E.g. to retrieve the “gclid” parameter, I used this:
get(split(get(split(decoded_base_url; "gclid="); 2); "&"); 1)
The Scenario
As already mentioned, the scenario is not crazy complicated. It looks like this:
Conclusion
Once again, Integromat has proven itself.
Instead of getting a developer, setting up a server to run this magic, explaining all the nuances and logic, complicated testing, I was able to simply build and test the integration myself in less than 2 hours. How cool is that?
Do you want to replicate this for your business yourself?
GO TO MAKE
Or looking for someone to build your integrations?
HIRE ME