# When a contract is signed, close the deal and tell the team

> The moment a contract is fully signed, we update the deal to closed won, file the signed copy, and announce the win to your sales channel.

- Workflow type: agent
- Services: SignWell, HubSpot, Google Drive, Slack Bot
- Categories: Sales, Operations
- Published: 2026-08-09

## What it does

- Picks up every contract the moment it is fully signed, then pulls out who signed, when they signed, and the signed copy itself.
- Finds the matching customer and their open deal in your CRM, moves it to closed won using the real signature date, and leaves a note with a link to the signed copy so the audit trail lives on the record.
- Files the contract into a per-customer folder in your shared drive, creating that folder the first time you close with a customer, then announces the win to your sales channel with the customer name, deal value, and a link to the filed contract.
- Knows when to stop: if the signer does not clearly match one customer and one open deal, it files the contract and flags the message for a human instead of guessing, and it never touches a deal that is already closed.

## What you'll need

- A SignWell account where you send contracts out for signature
- A HubSpot login that can update deals and add notes
- A Google Drive account, or a shared drive, where signed contracts should be filed
- A Slack workspace and the channel where you want wins announced

## Prompt

Run this whenever SignWell tells us a document has been fully signed. Use a webhook trigger and only act on the document_completed event. Ignore document_signed, document_viewed, document_in_progress and the other progress events: document_signed fires once per signer, while document_completed is the final stage change that means everyone is done.

Take the document id from the webhook payload and call SignWell Get Document to pull the document name, every recipient with their name and email, and each recipient's signing timestamp. Then call SignWell Get Completed PDF to retrieve the signed copy. Get Completed PDF returns binary by default; pass url_only=true when what you need is a download URL rather than the file itself, which is the easier path for putting a link in a message or a CRM note.

Work out which recipient is the customer rather than someone from our own side. That is normally the signer whose email is not on our own company domain. Search HubSpot with Search Contacts on that signer's email address.

A signer email may match several contacts or none at all, so handle both. If exactly one contact matches, use it. If there is no match, or more than one, fall back to the company domain from the signer's email and use Search Companies to find the customer's company record, then work from there. Do not invent or create a contact to make the match work.

With the contact or company in hand, use Search Deals to find the associated open opportunity. Never move a deal that is already closed: if the deal you find is already in closed won or closed lost, leave it exactly as it is and say so in the Slack message instead of updating it.

If confidence is low, do not guess at a deal. Low confidence means no contact match and no company domain match, or several plausible open deals with nothing that clearly ties one of them to this contract. In that case skip the deal update entirely, still file the signed PDF, and post the Slack message clearly flagged for human review, naming the document, the signer, and exactly what was ambiguous so a person can finish the job in seconds.

When there is exactly one confident open deal, call Update Deal to move it to closed won and set the close date to the signature date taken from the document, not today's date. Then call Create Note associated with that deal, recording the document name, the SignWell document id, each signer with their signing timestamp, and a link to the signed copy. Storing the SignWell document id on the record matters: it is what makes matching this contract to this deal reliable later, and it keeps the audit trail on the record instead of in someone's inbox.

File the PDF into Google Drive. Use List Files with a Drive query to check whether a folder already exists for this customer, call Create Folder only when one does not exist yet, and then use Upload File (Multipart) to put the signed PDF inside it. Name the file so it is findable later, for example the customer name, the document name, and the completion date. Multipart upload covers files up to 5MB.

Finally, post the win to the sales channel using Slack Bot Send a Message. Use the slackbot integration for this, not the user-level slack one. Include the customer name, the deal value, who signed, and a link to the filed document in Drive so nobody has to copy files around to see it. When the run was flagged for review, make that obvious at the top of the message and state plainly what a human needs to confirm.

Webhooks can be delivered more than once for the same document. Before writing anything, check whether this document has already been filed and already noted on the deal. If it has, skip the writes and do not post a duplicate announcement.

## How to customize

- Point the announcement at whichever channel your team actually watches, and change what the message includes, such as the customer name, deal value, or a link to the contract.
- Change how contracts are filed: a folder per customer is the default, but you can file by year, region, or contract type instead.
- Decide when a human gets pulled in. Some teams want review on every deal above a certain value, even when the match is obvious.

## FAQ

### What happens if the person who signed is not in our CRM?

It first tries to match the signer by their email address. If nothing matches, or several contacts match, it falls back to matching on the company domain from that email. If it still cannot tell which customer or deal the contract belongs to, it files the signed copy anyway and posts the announcement flagged for a human to confirm, rather than guessing at a deal.

### Will it ever change a deal that is already closed?

No. If the deal it finds is already marked closed won or closed lost, it leaves the deal exactly as it is and says so in the message, so a closed deal never gets quietly reopened or overwritten.

### Does this work when several people have to sign the same contract?

Yes. It waits until the contract is fully signed by everyone rather than reacting to each individual signature, and it uses the final completion date as the close date on the deal.

### Will this work on HubSpot Free?

Yes. It relies on deals, notes, and contact search, which are available on all HubSpot tiers including the free CRM. If your pipeline uses its own stage names, you can point it at whatever you call your final won stage.

### Where does the signed contract actually end up?

In a Google Drive folder for that customer, created automatically the first time you close a deal with them. Both the note on the CRM record and the Slack announcement link back to that filed copy, so nobody needs to email files around or keep a second copy.

Use this prompt in General Input: https://www.generalinput.com/prompts/when-a-contract-is-signed-close-the-deal-and-tell-the-team