Pipedrive automation step-by-step tutorial: delete all open tasks upon deal winning | Pipedrive & Omni CDI deep data series

Growth team efficiency suffers from countless small, energy-draining tasks. Every time they perform a mundane, manual task, productivity takes a hit. The solution? Automate the small stuff—and see how these small optimizations compound over time.

In this article, we’ll show you how to save hours each year by automating the deletion of deal activities in Pipedrive when a deal is won or lost—one of the 12 deep data automations included in our Pipedrive implementation package, Pipedrive Booster 2.0, and certainly one that our clients appreciate the most.

No Make, Zapier, or other subscription-based tools are required. This automation, along with 11 other deep data automations, runs through our custom-built analytics backend, Omni CDI, and is included at no extra cost with every Pipedrive implementation we offer. This service is available across all Pipedrive plans set up trough us, with no additional charges. For those who manage their own Omni CDI pipeline, this tutorial will be handy; for others, it provides an interesting look behind the scenes. Let’s dive in!

Step-by-step guide to deploying a real-time Pipedrive data pipeline

There are a couple of steps we’ll take together to deploy a real-time data pipeline for processing rich data using server-side tagging, tracking, and data activation, all running exclusively on our custom-built Omni CDI components. Here they are:

  1. Deploy your instance of Omni Analytics and configure the Omni Analytics endpoint.
  2. Create an Omni Analytics pipeline to capture Pipedrive events.
  3. Enable Pipedrive data capture in Omni Analytics and build the incoming event validation schemas.
  4. Build the event validation schema for outgoing events.
  5. Deploy the Omni Pipedrive Tag with Monitoring and Identity Resolution in the GTM Server container.
  6. Configure and authorize the tag.
  7. Verify everything is working.

Now, let’s dive into each step.

Deploy your instance of Omni Analytics and configure the Omni Analytics endpoint.

In the first step, you’ll need your own deployment of Omni Analytics. This is typically something we handle when you hire us for a Pipedrive implementation. Omni Analytics is a data collection and processing platform that processes individual events in real time, pushing them through multiple steps of validation, enrichment, and formatting before dispatching them for downstream use via the Pipedrive API. Built with Docker, Omni Analytics can be set up for you in minutes. Steps for deploying this tool are described on a dedicated Omni CDI documentation page.

Create an Omni Analytics pipeline to manage the capture, processing, and dispatch of Pipedrive events to GTM Server

Once your Omni Analytics instance is set up, it’s time to configure your Pipedrive event pipeline in the platform. This pipeline will manage your event queue from Pipedrive, processing events through multiple steps of enrichment and validation.

To do this, log in to your Omni Analytics instance, navigate to Pipelines > Add, and create a new pipeline.

Save it, then return to pipeline management. You should see your pipeline added with an access token generated. This access token ensures that your Pipedrive account can securely send events to your Omni Analytics instance.

Our Activation layer, which manages events, will use GTM Server as the destination at the pipeline level. While other options like Segment, Snowplow, and AWS Lambda are available, our Pipedrive Booster 2 package runs on GTM Server. We’ll configure GTM Server later on in the process.

Enable Pipedrive data capture in Omni Analytics and build the incoming event validation schemas

Creating a pipeline to process your Pipedrive events takes just a few clicks. However, before you can collect Pipedrive events, you need to establish a data protocol for your Omni Analytics pipeline to validate the events coming from your Pipedrive account. This ensures that only valid events are processed by the pipeline you’ve created.

Your pipeline data protocol includes event and property definitions. Predefined data points for each are already added to your Omni Analytics instance, so you don’t need to search through the Pipedrive API. Just ensure the names and scope make sense to you, or adjust them as needed. For reference, the default definitions are shown below.

It took just a few minutes to deploy your data collector instance, create a new data pipeline, and set up event validation schemas. Now you’re ready to ingest the first event from Pipedrive into the pipeline running in your private event analytics collector.

For that, go to your Pipedrive account. In the Tools and Apps section, click on Webhooks. Then, click + Webhook and select the standard webhook.

You can choose either Webhook v1 or Webhook v2, as your Omni Analytics instance and Pipedrive event pipelines are set up to work with both versions. For this example, let’s stick with v1. Once selected, click Next.

Once you’re in the webhook creation wizard, make sure to select the event action and object that will trigger your webhook. For this example, we want the Pipedrive webhook to notify us whenever a deal is won or lost. Both actions fall under the category of deal updates. Therefore, select update for the event action and deal for the event object.

Next, enter the endpoint you want Pipedrive to notify into the webhook configuration form. Here’s an example showing the completed webhook configuration.

Since Omni Analytics is deployed on a dedicated server instance, you have full control over your data and pipelines. The endpoint URL will depend on your domain. Generally, this instance will be available under collect.yourdomain.com, making the final endpoint to notify in the following format: https://your-omni-analytics-instance.yourdomain.com/webhook/pipedrive?access_token=your_pipeline_access_token.

The your_pipeline_access_token is the token you obtained from your Omni Analytics instance. This secret key comes from the pipeline you set up earlier, and you need to paste it here to ensure that all data flows are properly authenticated to your instance.

In just a few short steps, we’ve deployed a data analytics backend that enhances the capabilities of your Pipedrive account (available at no cost for every company that implements Pipedrive with us), created data pipelines and protocols, and enabled event flow for Pipedrive. All of this is happening in an environment where you control the data and flows.

One challenge of customer data platforms that Omni Analytics addresses is the ability to easily create multiple data pipelines for different environments without mixing the data they process.

A quick check to ensure everything works

Shall we run a quick test to check if everything is working properly? As you recall, this integration consists of multiple layers, including data capture via the Pipedrive webhook, data collection, enrichment, validation, and formatting with Omni Analytics, and a data activation layer that utilizes the processed data to manage your Pipedrive account via API by deleting activities once a deal is won. The data activation layer sits on top of the GTM Server (Google Tag Manager Server) container, where we have our custom-built Pipedrive tags for server-side tagging deployed.

Since our activation layer is built on the GTM Server in this specific pipeline, we can verify the event pipeline we’ve created so far in the GTM Server preview mode.

To test your pipeline in GTM Server preview mode and see how our events interact with the system, first enter the preview mode. Head over to your GTM Server instance and click “Preview”.

Preview mode for your server container works the same way as for a web container. To send a preview request from your Omni Analytics instance, which captures and formats Pipedrive events into one of the pipelines we’ve set up, you need to add the X-Gtm-Server-Preview header to your HTTP request. Fortunately, the built-in integration between Omni Analytics and GTM Server handles this for you. Simply copy the value of this header and then return to your Omni Analytics instance, select the pipeline responsible for processing your Pipedrive events, and paste the preview mode header, as shown above.

Are you ready to see if our events—generated by Pipedrive, captured, processed, and formatted by Omni Analytics, and relayed to GTM Server in real-time by the same tool—are visible in the preview log? Let’s find out!

Go to your Pipedrive account and try updating a deal by adding a new task or marking it as won. You should see the deal update event—corresponding to the event object and action we’ve configured for the Pipedrive webhook—populating the GTM Server preview event log.

Clearly, our Pipedrive events are reaching our GTM Server, which serves as the data activation layer, after being processed through the data collection, enrichment, and formatting layer managed by the Dockerized instance of Omni Analytics.

Is it enough for this pipeline to delete all completed activities once a deal is won? Absolutely not! The missing piece lies within GTM Server. Currently, we only have the container itself, but it also requires scripts to execute specific actions in response to Pipedrive events that hit this container. These scripts are called tags. For this, we’ll use our custom-built Pipedrive GTM Server tag. This tag is deployed as part of the analytics backend for every Pipedrive implementation we do. It integrates seamlessly with Omni Analytics, consuming all events created by Omni Analytics and dispatched in its unique format and custom payload.

Build the event validation schema for outgoing events

If you inspect the event payload reaching your GTM Server, you’ll see it’s nearly empty. This is because we haven’t configured the outgoing event schema yet. The schema defines which properties and data points should be included in the final event dispatched from Omni Analytics, including those generated by intermediate validations, enrichments, and checks configured in the specific pipeline. While we won’t explore the full range of this Omni Analytics feature here, we’ll provide a straightforward, simplified, minimal mapping and event schema to meet the goals that we have in this article.

To create your outgoing event schema, go to Mappers in your Omni Analytics, select the event consumer you want the schema applied to (here it’s GTM Server), and then add the following event property mappings.

Import the Omni Pipedrive Tag with Monitoring and Identity Resolution to the GTM Server container

In the GTM Server account, go to Tag Templates, and click New.

While in the tag addition wizard, click Import to import our official Pipedrive implementation tag for Pipedrive Booster 2.0.

After a moment, Omni tag should be uploaded and ready for use. For a quick check, you should see something like this in the tag preview panel.

You don’t need to change anything in the code, so just save it and return to the main GTM Server panel. It’s time to make use of that tag and actually complete out data pipeline. Let’s configure your tag then.

Once you’re in the GTM Server dashboard, go to Tags and click Add New. Then, click on the tag settings in the Tag Configuration panel and select your newly uploaded Omni Pipedrive Tag.

Once uploaded, all you need to do is configure the tag by naming it, setting up ingestion, and authorizing requests. Before fully configuring the tag, we need to prepare a couple of GTM Server variables to capture key information. We’ll go step by step for clarity, as in a real implementation, we would simply import the entire container into our workspace.

GTM Server variable config

Let’s create the variables. Go to the Variables section in your GTM Server container panel. We need four variables: two for authorizing requests to the Pipedrive API to manipulate your data, one to capture the ID of the won deal for which we want to delete activities, and one to capture the actual status of the deal. Let’s get started.

The first variable is the Pipedrive account URL. To find it, log in to your Pipedrive account, click the Profile icon, and go to Company Settings under Company Overview. Copy the company domain and paste it into the GTM Server variable of type Constant. Then, type your account name as an example.

We do the same for the Pipedrive API key. While in the Settings panel, navigate to Personal Preferences, select API, copy your API key and paste it into a new GTM Server variable of type constant, as shown below.

There’s only two additional variables we need to create.

The third variable will reference the ID of the deal for which we want to delete activities when it’s won. This variable will be sourced from the event sent to the data activation layer (Omni Activation) from the Omni Analytics instance. We’ll use the keys set up in the Omni Analytics pipeline mapper as the reference key in GTM Server.

To do this, click New in the GTM Server variables section and select Event Data as the variable type. The Event Data variable type allows you to set the value based on the specified event data key. The event data key we’re looking for is x-omni-data[id] or x-ga-mp2-data[id]. The first key represents the deal ID when using the Omni Data Client, while the second represents it when using the GA4 Data Client. In either case, it maps the event ID from the raw Pipedrive event payload to the id key in the final event payload after enrichment and validation steps, as it’s dispatched from Omni Analytics.

One last step: we want the tag to fire when a deal is won, so we need the deal status. We’ll extract this from the payload sent by Omni Analytics under the key current_status. Let’s create this variable just as we did for the deal ID.

Once all the variables are set up, your GTM Server variable set should look like this. That’s everything you need to run this automation using your own private data pipeline.

GTM Server Omni Tag config

With the variables set up, we can now finish configuring the tag. Just a few settings here. Omni Tag should already be added to the GTM Server workspace—we simply configure it as shown below.

For the Tag Event Type, select “Delete,” and for Object, choose “Activity.” This configures your tag to handle activity deletion. Next, enter your Pipedrive account domain and API token using the variables you’ve set up. Skip the intermediate settings and go directly to the Activity Properties and Settings section. Here, enable the option Bulk deletion of all activities associated with the deal. This option is specifically included because the standard Delete Activity action in the Pipedrive API usually handles single activity deletions rather than bulk deletions. We suggest keeping the next option as is: Bulk-remove only incomplete activities. If you prefer to delete all activities for a closed deal, you may deselect this option. Selecting both options will unlock the final required field: the ID of the deal for which you want to delete all open activities. Populate this field with the deal ID variable you set up earlier.

GTM Server trigger configuration

The last step before deploying tags to live data is to configure a trigger.

While in the GTM Server tag, scroll to the Triggering section, click Choose a trigger…, then click +, select Custom, and set up your trigger to activate when the event name is updated and the deal status is won. Your settings should look similar as below. As you can see, we’re using the deal’s current status as captured by the GTM Server variable we set up earlier.

At this point, everything is fully ready to go with our new data pipeline. Let’s see it in action!

Deep data Pipedrive automation: live demo

The pipeline is set to delete all upcoming, open activities for deals as soon as they’re won (extending this to cover lost deals would be trivial, just a couple of clicks). Let’s do a complete end-to-end demo.

For this demo, we’ve created a test deal with two completed tasks (a Call and a Meeting) and two upcoming activities (a Deadline on November 15 and Lunch on November 20).

The deal is open as we begin our test. All the details about this deal are shown below.

Now let’s consider the deal is won.

When the deal is won, the Pipedrive webhook sends a notification to your Omni Analytics instance via the configured endpoint. Omni Analytics ingests this incoming data into one of its pipelines after verification, then processes it through a series of steps. These steps culminate in packaging and structuring the enriched event according to the dispatch schema we’ve created. The real magic happens next on the GTM Server side, driven exclusively by the Omni Pipedrive Tag.

After clicking on the won deal, you will see that future activities are deleted immediately.

The video below illustrates this process.

As we see, the pipeline has deleted both activities associated with the deal. It’s important to note that, by using Omni Analytics, we can easily perform a multi-step integration within our GTM Server Omni Tag.

Examining the backend details of the Omni Pipedrive tag’s runtime, we can see the HTTP request details and the successful execution of the tag using the endpoints and access tokens entered at the beginning of the process.

Would you like to implement this and the remaining 11 powerful data integrations in your Pipedrive, regardless of the plan?

If you’ve enjoyed the tutorial, we’ve got a good news! Remember, this automation is just one of the 12 deep data integrations we provide with every Pipedrive implementation, whether on a free or paid plan. We empower your Pipedrive with a world-class data backend that eliminates any limitations. Don’t wait—take a look at the details of our Pipedrive implementation package, Pipedrive Booster 2.0, and schedule a call with us today, and let’s get started!

Photo by Jason Leung on Unsplash