Skip to content

CRM and sales

Send Contracts From Pipedrive Deals

Send a SignatureAPI contract when a Pipedrive deal is won. A Pipedrive automation calls an automation tool, which creates the envelope and updates the deal.

Pipedrive’s automation webhook action can send a JSON body, but its documentation lists no custom headers, and SignatureAPI needs the X-API-Key header. So the automation sends the deal to an automation tool’s webhook, and that tool makes the SignatureAPI request. No SignatureAPI app is needed.

Before you start

  • A SignatureAPI test API key (it starts with key_test_).
  • The document you send, at a URL on a supported host, or uploaded to SignatureAPI first. The examples use a sample PDF.
  • A Pipedrive plan with the webhook action in Automations. Pipedrive offers it on Growth and higher plans, and only global admin users can create automated webhooks.
  • An automation tool with an inbound webhook and an HTTP step, such as Make, Zapier or n8n.

Send the envelope

1

Create an inbound webhook in the tool

In your automation tool, create a webhook trigger and copy its URL. For Make, that is a Custom webhook in the Webhooks app.

2

Create an automated webhook in Pipedrive

In Pipedrive, go to Tools and apps > Webhooks, click + Webhooks, and select Automated webhook. Enter a name and the tool’s URL. Pipedrive requires the URL to end with /, &, ? or =, so add a ? to the end if it ends in anything else.

3

Add the webhook action to an automation

Create an automation that starts when a deal is won, and add the webhook action. Choose your webhook and the POST method, then build the body with the Raw option as JSON. Use the field button to insert the deal id, the person’s name and the person’s email. Pipedrive replaces each field with the deal’s data when it sends the request.

4

Create the envelope in the tool

Add an HTTP step after the webhook trigger and send this request, mapping the name, email and deal id from the webhook payload. Store the key in the tool’s own credential storage, not in the step text.

HTTP request step

Settings for the "Deal contract" request.

SettingValue
Method POST
URL https://api.signatureapi.com/v1/envelopes
Header X-API-Key: YOUR_API_KEY

Store the key in your tool's secret or credential storage when it has one.

Header Content-Type: application/json
Body (raw JSON)The JSON below.
Body (raw JSON)
{
  "title": "Service Agreement - Acme Corp",
  "message": "Please review and sign the service agreement for your order.",
  "metadata": {
    "source": "pipedrive",
    "deal_id": "1042"
  },
  "topics": [
    "no_code",
    "pipedrive"
  ],
  "documents": [
    {
      "key": "service_agreement",
      "url": "https://pub-9cb75390636c4a8a83a6f76da33d7f45.r2.dev/docs-samples/service-agreement.pdf",
      "format": "pdf",
      "fixed_positions": [
        {
          "place_key": "signer_signature",
          "page": 1,
          "top": 172,
          "left": 210
        }
      ],
      "places": [
        {
          "key": "signer_signature",
          "type": "signature",
          "recipient_key": "signer"
        }
      ]
    }
  ],
  "recipients": [
    {
      "type": "signer",
      "key": "signer",
      "name": "Jane Doe",
      "email": "jane.doe@example.com"
    }
  ]
}

data.envelope_metadata.deal_id comes back in every webhook event for this envelope, and the pipedrive topic lets an endpoint receive only these envelopes. Open Automations > History in Pipedrive and select a run to see the exact body Pipedrive sent.

Get the result back

The tool receives the result, because Pipedrive’s automation action only sends requests. Build it as a second scenario or workflow, as in Make.

1

Register the tool's URL in SignatureAPI

Create a second inbound webhook in the tool. In the Dashboard, add a webhook endpoint in test mode with that URL, subscribe to deliverable.generated, which fires when the signed PDF is ready, and add the pipedrive topic. The envelope.completed event comes earlier, while the PDF may still be generating, so use it only to update a status.

2

Read the envelope before you act

Anyone who knows a webhook URL can call it, so read the envelope with your key before you update the deal. Put the id from data.envelope_id in the URL:

HTTP request step

Settings for the "Completed envelope" request.

SettingValue
Method GET
URL https://api.signatureapi.com/v1/envelopes/eb4cf433-a8af-4161-b37b-7ef57d423e56
Header X-API-Key: YOUR_API_KEY

Store the key in your tool's secret or credential storage when it has one.

3

Update the deal

Send a PATCH request to https://companydomain.pipedrive.com/api/v2/deals/{id} with your Pipedrive API token in the x-api-token header, using metadata.deal_id as the id. Put the status in a custom field under custom_fields, whose keys are 40-character hashes (Update a deal, API v2, API v2 overview, authentication).

When deliverable.status is generated, deliverable.url downloads the signed PDF. That link expires after an hour, so download the file in the same run. If your account uses authenticated deliverable URLs, send your API key with the download. The same event can arrive twice, so skip a deal that already shows as signed. See Webhooks.