Deal won handoff when a PandaDoc contract is signed

The moment a PandaDoc contract is signed, mark the HubSpot deal Closed Won, file the signed PDF in Google Drive, and post the win in Slack.

Deterministic Code
PandaDocHubSpotGoogle DriveSlackSalesOperationsNotifications & AlertsData SyncDocument Processing

Build me a code workflow that runs the deal won handoff pipeline the moment a PandaDoc contract is fully signed. This is the classic post-signature housekeeping every sales-ops team wires up manually, and the steps are deterministic, so a code workflow is the right shape.

Trigger: a PandaDoc outgoing webhook on the document_state_changed event. Only continue the workflow when the new document status is completed (the fully signed terminal state). Ignore other status transitions (document.sent, document.viewed, document.voided, etc.).

Steps, in order, every time:

1) Pull document context from PandaDoc. Call Get Document Details on PandaDoc using the document id from the webhook payload. Read the signer/recipient name and email, the customer company name, the total contract value (grand total), the document name, and any metadata fields that contain a linked CRM deal id. Also call List Linked Objects for Document on PandaDoc so we can find a deal that was linked from inside PandaDoc's HubSpot integration. Prefer the linked-object deal id when present, fall back to a metadata field on the document, and as a last resort use HubSpot Search Deals to find an open deal whose primary contact email matches the signer's email.

2) Move the deal to Closed Won in HubSpot. Call HubSpot Update Deal on the resolved deal id, setting dealstage to the Closed Won stage of the deal's pipeline and writing the final contract amount (from PandaDoc's grand total) onto the amount property. If the deal already has a different amount, overwrite it with the signed contract amount, since that is the source of truth at close. Also capture the deal owner id from the deal record so we can mention them later in Slack.

3) Grab the signed PDF. Call Download Protected Document on PandaDoc to fetch the final, signed PDF bytes. This requires a production API key on PandaDoc; surface a clear error in setup if the connected key is sandbox-only.

4) File the PDF in Google Drive. Inside a configured parent folder named Signed Contracts, ensure a YYYY-MM subfolder exists for the current month (use Google Drive List Files to look it up, and Create Folder if it does not exist yet). Then call Google Drive Upload File (Multipart) to upload the PDF into that month subfolder. Name the file using the pattern "{Customer Company} - {Deal Name} - {HubSpot deal id}.pdf" so it is greppable later. Capture the resulting Drive file webViewLink.

5) Announce the win in Slack. Call Slack Send a Message to a configured channel (default #deals-closed). The message should include the customer company, the signed amount formatted as USD, the deal owner (mentioned by Slack user id if we can map it, otherwise by name), a link to the HubSpot deal record, and a link to the signed PDF in Google Drive. Keep the formatting clean and scannable.

Inputs/config the user should set on first run: PandaDoc workspace credential, HubSpot credential, Google Drive credential, Slack credential, the Closed Won dealstage id for their pipeline, the parent Google Drive folder id for Signed Contracts, the Slack channel id, and the metadata key on PandaDoc documents that stores the HubSpot deal id (if they use one).

Error handling: if the deal cannot be resolved by linked object, metadata, or signer email, do not silently drop the event. Still upload the signed PDF to Drive and post a Slack message saying a contract was signed but no HubSpot deal could be matched, including the customer name and a Drive link, so a human can reconcile.

Additional information

What does this prompt do?
  • Fires automatically the instant a PandaDoc contract is fully signed, so no one has to remember to update systems after a win.
  • Marks the matching HubSpot deal as Closed Won and writes the final contract amount onto the deal record.
  • Files the signed PDF into a Signed Contracts folder in Google Drive, organized by month, named with the customer and deal.
  • Posts a tidy win announcement to your deals channel in Slack with the customer, amount, deal owner, and links to the HubSpot deal and the Drive file.
What do I need to use this?
  • A PandaDoc account with permission to set up an outgoing webhook for completed documents.
  • A HubSpot login with access to update deals (move stage to Closed Won and edit the amount).
  • A Google Drive account with a parent folder you want signed contracts archived into.
  • A Slack workspace with a channel for closed deal announcements, like #deals-closed.
How can I customize it?
  • Change which Slack channel the win goes to, or send it as a DM to the deal owner instead.
  • Adjust the Google Drive folder structure or filename pattern, for example grouping by quarter or by account owner.
  • Add extra HubSpot fields to update on close, like contract start date, renewal date, or product line.

Frequently asked questions

What triggers this workflow?
A signed contract in PandaDoc. The workflow listens for the moment a document moves to completed and runs end to end from there, usually in under a minute.
What if the contract was not linked to a HubSpot deal in PandaDoc?
The workflow first checks for a linked HubSpot deal stored on the PandaDoc document. If none is found, it falls back to matching by the signer's email so deals still get closed out even when reps forget to link them.
Will this work if my team uses HubSpot Free?
Yes. The workflow only needs the ability to update an existing deal, which is available on every HubSpot plan that includes deals.
Where exactly does the signed PDF end up?
Inside your Signed Contracts folder in Google Drive, under a YYYY-MM subfolder for the month the deal closed, named with the customer and deal so it is easy to find later.
Can I customize what the Slack message looks like?
Yes. You can tweak the wording, the fields it includes, which channel it posts to, and even add emoji reactions or threading once the workflow is running.

Stop doing the closed won checklist by hand.

Connect PandaDoc, HubSpot, Google Drive, and Slack once, and Geni handles the post-signature housekeeping the moment a contract is signed.