How to create webhook in Pipedrive

To create a webhook in Pipedrive CRM using PHP, you can use the cURL library to make an HTTP POST request to the Pipedrive API. Here’s a PHP code example for creating a webhook in Pipedrive:

// Pipedrive API endpoint for webhooks
$pipedriveWebhookUrl = '';

// Your Pipedrive API token
$apiToken = 'YOUR_API_TOKEN';

// Webhook data to send in the request
$data = array(
    'subscription_url' => 'YOUR_WEBHOOK_URL', // URL where Pipedrive will send webhook data
    'event_action' => 'added.updated', // Events that trigger the webhook (you can adjust this as needed)

// Convert the data to JSON format
$jsonData = json_encode($data);

// Set up cURL for making the API request
$ch = curl_init($pipedriveWebhookUrl);

// Set cURL options
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'Accept: application/json',
    'Authorization: Bearer ' . $apiToken,

// Execute the cURL request
$response = curl_exec($ch);

// Check for errors
if (curl_errno($ch)) {
    echo 'cURL error: ' . curl_error($ch);
} else {
    // Process the API response
    $responseData = json_decode($response, true);

    if (isset($responseData['data']['id'])) {
        echo 'Webhook created successfully with ID: ' . $responseData['data']['id'];
    } else {
        echo 'Webhook creation failed. API response: ' . $response;

// Close the cURL session

In the code above:

1) Replace ‘YOUR_API_TOKEN’ with your actual Pipedrive API token.
2) Set ‘YOUR_WEBHOOK_URL’ to the URL where you want Pipedrive to send webhook data.
3) Adjust the ‘event_action’ as needed to specify the events that should trigger the webhook.

This PHP code sends a POST request to Pipedrive’s webhooks endpoint, and if the request is successful, it will return the ID of the created webhook.

Make sure you have cURL enabled in your PHP environment, and you have the necessary permissions to create webhooks in your Pipedrive account.

Scroll to Top