πŸ•ΈοΈ

Connect to Pipedrive using n8n

In this tutorial we will connect Friendly with Pipedrive by using n8n. If you want to push someone into Pipedrive, you can do it by (Push to integration) Campaign action in Friendly.

If you would like to have your contacts updated in Pipedrive, you can add an additional webhook to Pipedrive for updating contacts.

πŸ’‘
I will go step by step in this tutorial, but you can also take the shortcut by copy paste-ing the code at the end of this tutorial to your Friendly Connect / N8N.

0. Preparations

Have your pipedrive credentials ready for N8N

1. Set up a webhook trigger in N8N

image

Choose the webhook trigger and open the node.

image

Click on webhook URL to reveal the URL. Select the POST method.

2. Create the webhook in Friendly

image

Go to the webhooks in Friendly by clicking on the gear sign and choose webhooks.

Click on New.

image

Before you click on 'Send Test Payload', you have to make N8N listen. Click on the Execute Node button to start listening. Now you can Send the Payload in Friendly.

image

3. Search for the Pipedrive contact id

Now Friendly sends an example contact update event which will look like this:

image

Now close this window and add Pipedrive as the next node:

image

Now choose your credentials, and fill out the fields. We will do a search for a contacts.

πŸ’‘
Why are we searching? Because Pipedrive identifies contacts by ID, not email. So we need to find out the contact id first.

Then click on the gears by the Term field:

image

Choose Add expression, and click on the unfolding links by Webhooks as follows:

image

You managed to grab the email address, good job.

You can see the example data, once you close this window:

image

Now execute the Node, and recieve back something like this:

image

4. Update contact

Now we can continue building our function. Let's clos this and add another Pipedrive as next step.

I suggest you rename this new Pipedrive to avoid future confusion. Fill out the settings to make an update. Then click on the gear next to the person ID.

image

Now we need to open the links and find our ID. Looks like this:

image

Now let's add more info tho the updated conact. close this and choose Add Field.

image

Here again we will open the links, and choose email - value. Something like this will be filled out on the right side:

{{$node["Webhook"].json["body"]["mautic.lead_post_save_update"][0]["contact"]["fields"]["core"]["email"]["value"]}}

We can add one more field, called Name. In order to get firstname and lastname, we would need to get both values separated by a space and fill out as an expression. Will look like this:

{{$node["Webhook"].json["body"]["mautic.lead_post_save_update"][0]["contact"]["fields"]["core"]["firstname"]["value"]}} {{$node["Webhook"].json["body"]["mautic.lead_post_save_update"][0]["contact"]["fields"]["core"]["lastname"]["value"]}}
image

Once you click on executing the node, you will get a success report on updating that person in PD.

image

Now activate and save your node!

image

Enjoy!

5. Shortcut? Code to paste into your N8N:

{
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "938caff1-031c-44a5-9533-9cf965d7f40c",
        "options": {}
      },
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        570,
        310
      ],
      "webhookId": "938caff1-031c-44a5-9533-9cf965d7f40c"
    },
    {
      "parameters": {
        "resource": "person",
        "operation": "search",
        "term": "={{$node[\"Webhook\"].json[\"body\"][\"mautic.lead_post_save_update\"][0][\"contact\"][\"fields\"][\"core\"][\"email\"][\"value\"]}}",
        "additionalFields": {}
      },
      "name": "Pipedrive",
      "type": "n8n-nodes-base.pipedrive",
      "typeVersion": 1,
      "position": [
        770,
        310
      ],
      "credentials": {
        "pipedriveApi": ""
      }
    },
    {
      "parameters": {
        "resource": "person",
        "operation": "update",
        "personId": "={{$node[\"Pipedrive\"].json[\"id\"]}}",
        "updateFields": {
          "email": [
            "={{$node[\"Webhook\"].json[\"body\"][\"mautic.lead_post_save_update\"][0][\"contact\"][\"fields\"][\"core\"][\"email\"][\"value\"]}}"
          ],
          "name": "={{$node[\"Webhook\"].json[\"body\"][\"mautic.lead_post_save_update\"][0][\"contact\"][\"fields\"][\"core\"][\"firstname\"][\"value\"]}} {{$node[\"Webhook\"].json[\"body\"][\"mautic.lead_post_save_update\"][0][\"contact\"][\"fields\"][\"core\"][\"lastname\"][\"value\"]}}"
        }
      },
      "name": "Pipedrive Update",
      "type": "n8n-nodes-base.pipedrive",
      "typeVersion": 1,
      "position": [
        970,
        310
      ],
      "credentials": {
        "pipedriveApi": ""
      }
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Pipedrive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pipedrive": {
      "main": [
        [
          {
            "node": "Pipedrive Update",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Do you have any questions? We are happy to help you via πŸ“§ email, ☎️ phone and πŸ‘©β€πŸ’» video calls.

Click here to go back to the main help page:

Friendly AutomateFriendly Automate