Deal Sync
Automatically create contracts when CRM deals reach the right stage
Deal Sync Tutorial
Learn how to automatically create and send PandaDoc contracts when HubSpot deals reach the contract stage, eliminating manual document creation and accelerating your sales cycle.
The Problem
When a sales deal is ready for contract, sales teams typically:
- Manually log into PandaDoc or another contract system
- Find the right template and create a new document
- Copy deal data from the CRM into the contract
- Add recipients and send for signature
- Update the CRM with the document link
- Track signing status manually
This manual process causes:
- Delayed contracts - Hours between "ready to sign" and contract sent
- Data inconsistencies - Typos, wrong amounts, outdated information
- Lost deals - Momentum dies while waiting for paperwork
- No visibility - Sales managers can't see contract status at a glance
The Solution
Build a workflow that automatically:
- Triggers when a HubSpot deal moves to "Contract Sent" stage
- Retrieves deal and contact information
- Creates a contract from a PandaDoc template with deal data
- Sends the contract for signature
- Updates the HubSpot deal with the document link
- Notifies the sales team in Slack
- (Bonus) Updates the deal when the contract is signed
What You'll Build
Prerequisites
Required Connections
| Provider | Connection Type | Purpose |
|---|---|---|
| HubSpot | OAuth via Nango | Receive webhooks, get/update deals |
| PandaDoc | OAuth via Nango | Create and send documents |
| Slack | OAuth via Nango | Team notifications |
HubSpot Setup
-
Configure Webhook Subscriptions in your HubSpot app:
- Subscribe to
deal.propertyChangeevents - Include
dealstageproperty in the subscription
- Subscribe to
-
Deal Pipeline Stages: Note your stage IDs
- Go to Settings → Objects → Deals → Pipelines
- Find the internal ID for your "Contract Sent" stage (e.g.,
contractsent)
-
Custom Properties (recommended):
contract_url(Single-line text) - To store PandaDoc linkcontract_status(Dropdown) - Draft, Sent, Viewed, Signed
PandaDoc Setup
-
Create Contract Template:
- Go to Templates → Create Template
- Design your contract with placeholder fields
- Add tokens for dynamic data (deal amount, company name, etc.)
- Note the template ID from the URL
-
Configure Tokens in your template:
{{deal_name}}- Deal/opportunity name{{deal_amount}}- Contract value{{company_name}}- Customer company{{contact_name}}- Signer name{{contact_email}}- Signer email
Step-by-Step Implementation
Step 1: Create the Workflow
Start with the trigger configuration:
Why this filter?
- HubSpot sends property change events for any deal update
- We filter to only trigger when
dealstagechanges tocontractsent - This prevents duplicate contract creation
Step 2: Get Deal Details
Retrieve the full deal information:
Key properties:
dealname- The deal/opportunity nameamount- Contract valueclosedate- Expected close dateassociations- Returns linked contacts and companies
Step 3: Get Primary Contact
Retrieve the contact who will sign the contract:
Output includes:
firstname,lastname- Contact nameemail- For contract deliveryjobtitle- For contract personalization
Step 4: Get Company Details
Retrieve the associated company:
Step 5: Create PandaDoc Document
Create the contract from your template:
Key configuration:
templateId- Your PandaDoc template IDrecipients- Who needs to signtokens- Dynamic values to populate in the contractmetadata- Track the source deal
Step 6: Wait for Document Processing
PandaDoc needs time to process the document:
Step 7: Send Document for Signature
Send the contract to the recipient:
Step 8: Create Signing Link
Generate a direct signing link:
Parameters:
lifetime- Link validity in seconds (604800 = 7 days)
Step 9: Update HubSpot Deal
Update the deal with contract information:
Step 10: Notify Sales Team
Send a Slack notification:
Complete Workflow
Here's the complete workflow JSON:
Testing
1. Create Test Workflow
2. Activate Workflow
3. Test with Simulated Webhook
4. Verify Results
| System | What to Verify |
|---|---|
| PandaDoc | New document created and sent |
| HubSpot | Deal updated with contract_url |
| Slack | Notification in #sales-contracts |
| Recipient Email | Contract email received |
5. End-to-End Test
- Create a test deal in HubSpot with a contact and company
- Move the deal to "Contract Sent" stage
- Watch the workflow execute
- Verify contract created in PandaDoc
- Check recipient received signing request
Bonus: Handle Contract Signed
Create a second workflow that triggers when the contract is signed:
Error Handling
Handle Missing Contact
Handle PandaDoc Errors
Notify on Failure
Variations and Extensions
Multiple Signers
Add a counter-signer from your company:
Different Templates by Deal Size
Use conditional logic to select templates:
Salesforce Variant
Use Salesforce instead of HubSpot:
Add Legal Review Step
For high-value deals, add a legal review step:
Common Issues
| Issue | Cause | Solution |
|---|---|---|
| Document not created | Invalid template ID | Verify template ID in PandaDoc |
| Missing recipient | No contact on deal | Add validation step, require contact |
| Duplicate contracts | Webhook retries | Add idempotency check using deal ID |
| Wrong data in contract | Incorrect token names | Match template tokens exactly |
| Send failed | Document still processing | Increase delay or poll for status |