Raise a Zoho Books invoice the moment a HubSpot deal is won

When a deal moves to closed won in HubSpot, we find or create the customer in Zoho Books, draft the invoice, and tell finance in Slack.

Deterministic Code
HubSpotZoho BooksSlackSalesFinanceData SyncNotifications & Alerts
PromptCreate

Watch HubSpot for deal updates and, whenever a deal moves into a closed won stage, raise the matching draft invoice in Zoho Books automatically so sales never has to hand off to finance by hand. Use a poll trigger on HubSpot deals_updated as the entry point.

First resolve what closed won actually means in this account. Call List Pipelines for deals and find the stage that is marked as the closed won stage, rather than hardcoding a stage label or id, because stage ids are pipeline specific. If the updated deal is not in that stage, stop and do nothing.

Read the deal with Search Deals, filtering on the deal id from the trigger, and pull the deal name, amount, currency, close date, pipeline, deal stage, and owner id. There is no plain get deal operation in the catalog, so Search Deals with an id filter is the way to fetch it. If the amount is zero, blank, or missing, stop without creating anything. Resolve the deal owner's name and email with Get Owner using the owner id on the deal.

Before touching anything in Zoho Books, check whether this deal has already been invoiced. Call List Invoices and look for an invoice whose reference number is the HubSpot deal id. If one exists, stop. This is the deduplication guarantee: the same closed won deal must never produce two invoices, even if the deal is edited, reopened, or closed again later. Do not rely on any in memory state for this, the reference number on the invoice is the source of truth.

Resolve the billing customer. Use Batch Read Associations on the deal to get its associated company ids and contact ids. Fetch the company with Search Companies to get the company name, domain, and billing address, and fetch the associated contacts with Search Contacts to get the primary contact's first name, last name, and email. If the deal has more than one associated contact, use the first one as the billing contact. If the deal has no associated company, fall back to the contact's name for the customer record.

Look the customer up in Zoho Books with List Contacts, matching on the company name first and falling back to the billing contact's email address. If nothing matches, create the customer with Create Contact using the company name as the customer name, the HubSpot contact as the primary contact person, and the currency from the deal.

Raise the invoice with Create Invoice against that customer. Use a single line item with the deal name as the description and the deal amount as the rate, set the invoice date to the deal close date, and set the due date to the close date plus 30 days for net 30 terms. Put the HubSpot deal id in the invoice reference number so the deduplication check above can find it on the next run. Leave the invoice as a draft rather than marking it sent.

Finish by posting to Slack with Send a Message to the finance channel. Address the message to the deal owner by name so they know the handoff is done, and include the customer name, the invoice amount and currency, the Zoho Books invoice number, and the due date, plus a link back to the HubSpot deal. Send exactly one message per invoice created.

Build this as a deterministic code workflow. Every step is a known lookup, mapping, or create over structured CRM fields, so no judgement, drafting, or summarization is required.

What does this prompt do?

  • Watches your HubSpot pipeline and picks up every deal the moment it moves into closed won.
  • Finds the billing company and its main contact, then matches them to a customer in Zoho Books or creates one if they are new.
  • Drafts the invoice with the deal value, the deal name as the line description, and a due date 30 days after the close date.
  • Posts a note in Slack with the customer, amount, invoice number, and due date so the rep and finance both know it is handled.

What do I need to use this?

  • A HubSpot account with deals and a pipeline that includes a closed won stage
  • A Zoho Books account where you raise customer invoices
  • A Slack workspace and a channel for finance notifications
  • Deal amounts filled in on your HubSpot deals, since deals with no value are skipped
  • Companies and contacts linked to your deals in HubSpot, so we know who to bill

How can I customize it?

  • Change the payment terms from net 30 to whatever your business uses, or read them from a field on the deal
  • Swap the finance channel, or add your sales channel so the whole team sees new wins
  • Decide whether invoices stay as drafts for review or go out as soon as they are created
  • Limit it to one pipeline so only new business gets invoiced and renewals stay manual

FAQs

Will the invoice be sent to the customer automatically?
No. Invoices are created as drafts in Zoho Books so someone in finance can check the amount, tax, and contact details before sending. If you would rather they go straight out, that is a one line change when you set it up.
What happens if the customer is not in Zoho Books yet?
We create them. The company name, plus the main contact's name and email from HubSpot, become a new customer record, and the invoice is raised against it.
Can the same deal be invoiced twice?
No. Every invoice is stamped with the deal it came from, and we check for an existing invoice before creating one. Reopening, editing, or re-closing the same deal will not produce a duplicate.
What about deals with no amount on them?
They are skipped. Deals with a zero or blank value never produce an invoice, so placeholder and test deals will not clutter your books.
Does this work with custom pipelines and renamed stages?
Yes. We read your pipeline setup to find the real closed won stage rather than matching on a fixed label, so it keeps working if you rename stages or run several pipelines.

Related templates

Auto-fix your calendar when a flight slips, and flag what's at risk

When your flight moves, your calendar times get corrected automatically and you get a Slack note naming the meetings you're about to miss.

Google Calendar
AviationStack
Slack
Agentic Task
Trace phishing emails to the sending IP and report abuse

Every 15 minutes, forwarded phishing reports get traced back to the server that really sent them, with a verdict in Slack and the worst senders reported.

AbuseIPDB
Gmail
Slack
Agentic Task
Log Agorapulse social conversations to HubSpot contacts

Twice every weekday, the conversations from your social inbox land on the right HubSpot contact timelines, with a Slack recap for sales.

Agorapulse
HubSpot
Slack Bot
Agentic Task
Turn procurement portal tenders into CRM deals each morning

Every weekday at 7am, sign in to the tender portals you track, filter new notices against your bid criteria, and open a deal for the ones worth chasing.

Anchor Browser
Google Sheets
HubSpot
+1
Agentic Task
Clean up HubSpot contacts from your Amazon SES suppression list

Every morning, find the addresses that hard bounced or filed a spam complaint, update the matching HubSpot contacts, and post a short Slack recap.

Amazon SES
HubSpot
Slack Bot
Agentic Task
Provision customer entitlements in DynamoDB when a deal is won

When a HubSpot deal hits Closed Won, the customer's plan, seats and renewal dates land in your DynamoDB accounts table, with a Slack note showing what changed.

HubSpot
Amazon DynamoDB
Slack Bot
Agentic Task

Stop retyping won deals into your accounting system.

Sales closes the deal, finance gets the invoice, and nobody copies numbers between two tabs.