Guides & tutorials

Lead generation flow with Pipedrive

Table of contents

Learn how to build a lead generation flow that will automatically send new leads to the corresponding salesperson and pipeline.

Previous requirements

  • A Pipedrive account to save the data of the new leads.
  • An Arengu account to create the form and the server-side logic.

Overview

This use case consists of a one-step form that asks for basic data and allows the user to choose the course to request more information about. An after-submission flow is connected to it to send the data to the corresponding pipeline and salesperson in Pipedrive.

Create the form

First, open the Arengu form editor and start a form from scratch. Add the fields you need by dragging and dropping them from the side menu. In this case, we will include two text fields, a phone field, an email field, a dropdown field and two checkboxes. 

Configure the text, number and email fields with these settings:

  • ID: change it to ‘name’, ‘surname’, ‘phone’ and ‘email’.
  • Required: enable this checkbox to make them mandatory.

To configure the dropdown:

  • ID: change it to ‘course’.
  • Required: enable this checkbox to make it mandatory.
  • Options: list here the options you want to display in the dropdown.
  • Internal values: define an internal value for each course to reference them in the flow.

And to configure the checkboxes:

  • ID: change them to ‘commercial’ and ‘legal’.
  • Required: enable this checkbox to make it mandatory.
  • Transient: enable this option to avoid this data being stored in Arengu.

You can use the hidden fields to track the origin of the leads, for example, if you use the form in landing page campaigns. To configure them:

  • Hidden fields: in the left column, define the utm that you want to track. In the right column, leave the fields blank as they will be filled in automatically.

Then go to the Flows tab in the light grey menu and create an after submission flow by clicking on the plus button and giving it a name. Finally, publish the changes.

Build the after-submission flow

The flow that we just created will have this structure:

Open it in a new tab and add the following actions by clicking on the plus button. First, add a Store state variable action with these settings:

  • ID: change it to ‘storeStateVariable’ to make it easier to reference.
  • Data fields: we will define two variables more to reference the commercials in the flow: “user_commercialName”, followed by the proper Pipedrive user ID. You can get it from the Pipedrive API using the provided Postman collection.

Next, include an Input value mapping action, with the following settings, to link each course with the corresponding salesperson:

  • ID: change it to ‘mapUserId’.
  • Input value: reference the {{input.body.course}} variable from the form.
  • Mapping table: in the left column, create an ID for each course, the same referenced in the Internal Values ​​of the form dropdown. In the right column, reference in each case the variable of the corresponding salesperson.
  • Default output value: reference the variable of the sales person to whom the leads will be assigned in case no matches are found in the mapping table.

Add another Input value mapping action to link each course with the corresponding stage of the pipeline in Pipedrive. Configure it as follows:

  • ID: change it to ‘mapCourse’.
  • Input value:  reference the {{input.body.course}} variable from the form.
  • Mapping table: in the left column, list again the ID of each course and, in the right column, the corresponding stage ID. You can get it also from the Pipedrive API.

Next include a Add Pipedrive person action with the following settings:

  • ID: change it to ‘addPipedrivePerson’.
  • Connection: choose an existing Pipedrive connection or create a new one by clicking on the plus button and pasting the API key of your Pipedrive account. You will find it under your Personal preferences menu > API.
  • Name: reference the {{input.body.name}} variable from the form.
  • Email: reference the {{input.body.email}} variable from the form.
  • Phone: reference the {{input.body.phone}} variable from the form.
  • Owner ID: reference the {{mapUserId.result}} variable from the outputs of the first Input value mapping action after an execution of the flow.
  • Custom fields: create a custom field in Pipedrive to save the surname, paste its Pipedrive ID in the left column and reference the {{input.body.surname}} variable in the right column.

Include a Add Pipedrive deal action with these settings:

  • ID: change it to ‘addPipedriveDeal’.
  • Connection: select the same connection that you used in the previous action.
  • Title: reference the ‘{{mapDealData.result.title}}’ variable from the outputs of the first action of the flow.
  • User ID: reference the {{mapUserId.result}} variable from the outputs of the first Input value mapping action.
  • Person ID: reference the {{addPipedrivePerson.body.data.id}} from the outputs of the previous action after an execution of the flow.
  • Stage ID: reference the {{mapCourse.result}} variable from the outputs of the second Input value mapping action of the flow.
  • Custom fields: create a custom field in Pipedrive for each hidden field, paste their Pipedrive IDs in the left column and reference the corresponding variables in the right column.

Finally add Send Mailjet email action to send the welcome email to the new lead and configure it as follows:

  • Connection: choose an existing Mailjet connection or create a new one by clicking on the plus button and pasting the API key and Secret Key of your Mailjet account.
  • Sender email: include the email address from which the email will be sent.
  • Recipient email: reference the {{input.body.email}} variable from the form.
  • Subject: write the subject of the email.
  • Message: write the message of the email. You can use HTML in this field or use a saved template.

Finally, publish the changes.

Preview, test and debug

Go back to the Form editor and click on the Preview button to test it. Check if everything is working properly, action by action, on the Executions tab of each flow.

Haven't you tried Arengu yet? Sign up free or schedule a demo with our team!

You might like to read

Getting started with Arengu

Arengu allows you to build all your user flows connected to your current stack, and avoids coding all the UI, complex integrations, validations or logic from scratch. Try it for free and start building faster and scaling your application needs as they grow.