Webhook endpoint being hit multiple times

Hi everyone,

A client and I are experiencing issues with our webhook endpoint being hit multiple times by Pipedrive. We’ve observed this issue with a number of different events as well (update.deal, added.activity, and added.note). Each one can produce 2-3 extra triggers on top of the first. This presents an issue as my client uses Claris Connect which counts its monthly step limit based on the number of steps each activated flow goes through. Right now, our flow has about 6 steps. These “ghost” triggers cause each event we want to trigger for our webhook to use about 24 steps towards our monthly limit.

I’d appreciate any help with stopping these extra triggers from happening. Below is the meta block of what was sent through the webhook the last time an event was run.

First one sent:

Second one sent:

Third one sent:

Fourth one sent:

1 Like

Hi, you didn’t include the part of the response JSON that shows the retry counter, but this sounds like something that could be caused by retried deliveries. According to Pipedrive docs, webhooks will be re-delivered if PD doesn’t get a response within 10 seconds or if the response code is not 2xx.

Just fixed a similar bug in my own code this week where I had erroneously assumed that a deal.added hook will never be called more than once per deal.

1 Like

Hi, thanks for your response.

I did forget to include the part of the JSON that shows the retry counter. After investigating, it was retrying because PipeDrive wasn’t receiving a 2xx response code. After correcting it, all seems well now. We went ahead and updated to v2 of the webhooks as well since we were already fixing things.

Thanks again for your help!

1 Like

Hi VNitsua, I’m having trouble getting Pipedrive to receive the 2xx response code, what is the syntax for that?

Currently I have something along the lines of:

try {
    var response = UrlFetchApp.fetch(apiUrl, options);
    Logger.log('Pipedrive response: ' + response.getContentText());

    if (response.getResponseCode() != 200) {
        throw new Error(`Pipedrive update failed with status code ${response.getResponseCode()}: ${response.getContentText()}`);
    }

    Logger.log('Successfully updated Pipedrive: ' + response.getContentText());
} catch (e) {
    Logger.log('Error updating Pipedrive: ' + e.message);
    throw new Error(`Address unavailable: ${apiUrl} - ${e.message}`);
}

}

// Helper function to create a response
function createResponse(message, statusCode) {
return ContentService.createTextOutput(JSON.stringify({ status: ‘success’, message: message, statusCode: statusCode }))
.setMimeType(ContentService.MimeType.JSON);
}