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

By General Input

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.

Integrations

  • SignWell
  • HubSpot
  • Google Drive
  • Slack Bot

Type

Agentic Task

Categories

  • Sales
  • Operations

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.

Related prompts

Explore more prompts
A brand asset library your marketing team actually searchesTurn Mailjet email clicks into ranked HubSpot follow-upsClean out the Looker dashboards and Looks nobody opensLiveKit live operations console for room moderationWake up dormant Keap leads with a researched reasoniMessage campaign console with pre-flight checks and delivery boardLiveChat coverage board for planning next week's shiftsPhone routing control panel for LiveKit voice agentsA searchable RFP answer library your bid team drafts fromLinkedIn Ads budget pacing dashboard for every client account