Create Deal request creates multiple deals - No stopping

I’ve recently gotten into Pipedrive and want to automate my website to generate deals to follow up on when someone reachs a certain part of my wordpress website. I used the default instructions for how to create a deal (Creating a Deal) and pasted the full code into a function which is called on a certain page.

I’ve also set up a webhook to receive requests from that particular Endpoint URL.

When the function is triggered the deal is added to my pipedrive with the information I set it to. Great. However, after this first successful request is finished my pipedrive is FILLED with duplicates of the same deal containing the exact same information. Approximately 1 new deal is created every second and I need to delete the webhook for the deals to stop generating and flooding my pipedrive.

I use the exact same code as in the example above. I’m not sending more than one request from my website since the code only runs once.

What am I doing wrong? I only want one deal to be created, not multiple.

Are you positive you don’t have any other triggers set up so that when a deal is created another deal also gets created?
What happens when you manually create a deal?

Hi David,

I’ve now deleted the webhook and tried to call the same code on my website I initially called and it now correctly only creates one deal. I think that the webhook got stuck in an infinite loop when the website called the webhook?

Aren’t you suppose to create a webhook and then call it from the code? or is that not best practice?

Thanks for the quick response!

You need to use webhooks when you want data to receive data from Pipedrive every time something happens.
In your case you want to send data.

So, if you just want to create a deal when someone reaches your page, you just need to send the new deal to Pipedrive using the code you copy/pasted. No need to create any webhook. Otherwise, this is what happens:

  1. Your URL is called (the page is visited) -> you send a new deal via API
  2. The webhook is triggered -> your page is called again -> back to step 1

There’s your infinite loop and flooded pipeline and chaos and darkness.

So, as you’ve already done, simply delete the webhook and things should work fine again.

Let me know if that helps :slight_smile:

2 Likes

Thanks for the detailed answer dani!

This was the solution to my problem, thanks for verifying it and specifying all the details around it. Very helpful! :slight_smile:

1 Like