Webhook with a Script - How to tell Pipedrive it was successful? Http Status Code Help

Bart Rygal_59361
Bart Rygal_59361 Member Posts: 2 VERIFIED MEMBER
Second Anniversary Photogenic
edited June 6 in Apps and Integrations #1

Hi Pipedrive Community,

I set up a webhook with a Google Script, it gets triggered fine, it works perfectly, but Pipedrive keeps retrying and it ultimately ends up saying it failed.

I don't know if I'm implementing the status code correctly:

    // Return a success message with a 200 status code
    return createResponse('Folders and Google Sheet processed successfully. Pipedrive updated.', 200);
} catch (error) {
    Logger.log('Error creating folders or updating Pipedrive: ' + error.message);
    sendErrorNotification('bart@northmortgage.ca', error);
    return createErrorResponse(error);
}


// 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);
}

This are just a few of the snippets of the code, I can share more if needed of course.

Any thoughts on how to get this to work?

Tagged:

Answers