Create QuickBooks invoices the moment HubSpot deals close won

When a HubSpot deal flips to closed won, an agent finds or creates the customer in QuickBooks, drafts the invoice, and confirms it in your finance Slack channel.

Agentic Task
HubSpotQuickBooks OnlineSlack BotFinanceSalesData SyncNotifications & Alerts

Build an agent workflow that turns every closed won HubSpot deal into a QuickBooks invoice and posts a confirmation in our finance Slack channel.

Trigger: HubSpot webhook on deal property change, filtered to the dealstage property switching to closed won (closedwon). The webhook payload gives the agent the dealId to work with.

When the workflow fires, the agent should:

1. Call HubSpot Get Deal for that dealId with associations to contacts, companies, and line items. Pull the deal amount, close date, owner, and the associated line items. Also pull the primary associated contact (email, first name, last name, phone) and the primary associated company (name, domain, billing address). If the deal is missing a primary contact or company, post a Slack message flagging the gap and stop.

2. Find or create the QuickBooks customer. Use QuickBooks Query Entities to search Customer first by the contact's email (PrimaryEmailAddr), then by the company DisplayName if no email match. If a customer exists, reuse its Id. If not, call QuickBooks Create Customer with DisplayName set to the company name (fall back to the contact full name), PrimaryEmailAddr set to the contact email, billing address from the company, and phone from the contact. The agent should reason about close-but-not-exact matches and prefer reusing an existing record over creating a duplicate.

3. Map deal line items to QuickBooks items. For each HubSpot line item, look up a QuickBooks Item with a matching name using Query Entities. If nothing matches, fall back to a configurable default service item (the user picks this during setup). Build the invoice line array with the item reference, quantity, unit price, and description from the HubSpot line item.

4. Call QuickBooks Create Invoice with the matched CustomerRef, the mapped Line array, and TxnDate set to the HubSpot deal close date. Capture the new invoice's DocNumber and Id.

5. Post a confirmation to a Slack channel (default to #finance, let the user change it at setup) using Slack Bot Send a Message. The message should include the customer DisplayName, invoice total (TotalAmt), invoice DocNumber, and a link back to the original HubSpot deal (https://app.hubspot.com/contacts/{portalId}/record/0-3/{dealId}). Format it cleanly with mrkdwn.

Error handling: if the QuickBooks customer create fails, if no line items map and there is no default service item set, or if the invoice create returns a Fault, the agent should post a Slack message in the same channel describing what failed and which HubSpot deal it was for, then stop without creating partial records.

Use the Slack Bot integration (not the user-token Slack one) so the confirmation comes from a bot identity that does not depend on any single user staying in the org.

Additional information

What does this prompt do?
  • Listens for HubSpot deals moving to closed won and kicks off automatically, no copy-pasting deal amounts between tools.
  • Looks up the contact or company in QuickBooks first, then creates a new customer only if one does not already exist, so you do not get duplicates.
  • Builds the invoice from the deal's line items and close date, falling back to a default service item when a line does not match anything in QuickBooks.
  • Drops a clean confirmation in your finance Slack channel with the customer name, invoice total, invoice number, and a link back to the original HubSpot deal.
What do I need to use this?
  • A HubSpot account with permission to read deals, contacts, companies, and line items.
  • A QuickBooks Online account with the right to create customers and invoices.
  • A Slack workspace where you can add the General Input bot to your finance channel.
  • A default QuickBooks service item to use when a deal line item does not have an exact match.
How can I customize it?
  • Point the confirmation message at a different Slack channel, or send a DM to your controller instead.
  • Tighten the trigger to only fire for a specific HubSpot pipeline, deal amount threshold, or owner.
  • Adjust how line items are mapped, set a different default item, or attach standard payment terms to every invoice.

Frequently asked questions

Will this create duplicate customers in QuickBooks?
No. The agent searches QuickBooks for an existing customer by the contact's email and the company name first, and only creates a new customer when nothing matches.
What happens if a deal has a line item that does not exist in QuickBooks?
The agent maps each deal line item to a QuickBooks item by name. When there is no exact match, it falls back to a default service item you choose during setup, so the invoice still goes through.
Does the invoice get emailed to the customer automatically?
Not by default. The agent creates the invoice in QuickBooks and confirms it in Slack so your team can review before sending. You can ask the agent to email it on the spot if you prefer.
Can I send the confirmation somewhere other than Slack?
Yes. Swap Slack for email or a different channel during setup. The confirmation includes the customer name, invoice total, invoice number, and a link back to the HubSpot deal.
Why use an agent instead of a fixed step-by-step automation?
The customer match and line item mapping are the parts that usually break a rigid Zap. An agent can reason about a fuzzy email or company match and pick a sensible item fallback, instead of erroring out and dropping the invoice.

Stop hand-writing invoices for every closed won deal.

Connect HubSpot, QuickBooks, and Slack once. Geni runs this every time a deal closes, so your books match your CRM.