HubSpot 'Closed-Won' Deals to Xero Invoices (Make.com)

Automate accounting workflows by instantly generating Xero invoices from closed HubSpot deals using Make.com.

Tools: HubSpotXero

Platform: Make.com

Short Answer

A seamless, real-time sync where every 'Closed-Won' deal in HubSpot triggers the creation/update of a Xero Contact and a corresponding Draft Invoice, including specific line items and tax considerations.

The Problem

Manual entry of sales data into accounting software causes billing delays, human error in line-item pricing, and data silos between Sales and Finance teams. Sales reps lose visibility into whether their deals have been converted into invoices.

The Outcome

A seamless, real-time sync where every 'Closed-Won' deal in HubSpot triggers the creation/update of a Xero Contact and a corresponding Draft Invoice, including specific line items and tax considerations.

Step-by-Step Guide

1. **Create Scenario**: Log into Make.com, click '+ Create a new scenario', and name it 'HubSpot to Xero Invoice Sync'. 2. **HubSpot Trigger**: Add the 'HubSpot CRM' module and select 'Watch Deals'. Connect your account via OAuth2. Set the 'Property to monitor' to 'Deal Stage'. 3. **Set Filter**: Click the link between the HubSpot module and the next step. Label it 'Only Closed-Won'. Set the condition where `Deal Stage` (ID) equals your specific 'Closed Won' internal ID. 4. **Fetch Line Items**: Add the HubSpot 'List Line Items for an Object' module. Map the 'Deal ID' from the trigger to ensure you retrieve the products associated with the deal. 5. **Xero Contact Lookup**: Add the 'Xero' module 'Get/Search for a Contact'. Search by 'Name' or 'Email' using HubSpot Company data. 6. **Create/Update Contact**: Use a 'Router' or the 'Update a Contact' module if the search returns no results, ensuring the Xero ledger has the latest address from HubSpot. 7. **Map Line Items (Iterator)**: Use a Make.com 'Iterator' if there are multiple products. Map the array of line items from Step 4. 8. **Create Xero Invoice**: Add the 'Xero' module 'Create an Invoice'. Map the Contact ID from Step 5. Set the 'Status' to 'DRAFT'. Map line items using the `map()` function or the Iterator's output. 9. **Currency & Date Formatting**: Use Make's built-in functions: `{{formatDate(now; "YYYY-MM-DD")}}` for the invoice date and `{{parseNumber(deal_amount)}}` to ensure numerical compatibility. 10. **Update HubSpot**: Add a HubSpot 'Update a Deal' module. Map the Xero Invoice ID to a custom HubSpot field 'Xero Invoice Link' to provide visibility to the sales team. 11. **Error Handling**: Right-click the Xero module and select 'Add error handler'. Choose 'Break' or 'Email' to notify the admin if an invoice fails due to missing tax rates or account codes.

Data Mapping

| HubSpot Field (Source) | Xero Field (Destination) | Transformation Syntax | Required? | | :--- | :--- | :--- | :--- | | Deal: Deal Name | Invoice: Reference | `{{1.dealname}}` | No | | Deal: Amount | Invoice: Line Amount | `{{parseNumber(1.amount)}}` | Yes | | Company: Name | Contact: Name | `{{if(empty(3.name); 3.domain; 3.name)}}` | Yes | | Line Item: Quantity | Invoice Line: Quantity | `{{4.quantity}}` | Yes | | Line Item: Price | Invoice Line: Unit Amount | `|{{4.price}}` | Yes | | Close Date | Invoice Date | `{{formatDate(1.closedate; "YYYY-MM-DD")}}` | Yes |

Gotchas & Failure Modes

• **Rate Limits**: HubSpot and Xero have rate limits; if syncing bulk history, use the 'Sleep' module or set the scenario to 'Sequential processing' in settings. • **Account Codes**: Xero requires a 'Chart of Accounts' code (e.g., 200 - Sales) for every line item. Ensure this is hardcoded in Make or mapped via a HubSpot custom property. • **Tax Types**: Ensure the Xero Tax Type (e.g., 'OUTPUT') matches the regional settings; otherwise, the API will return a 400 error. • **Bundle Handling**: If a HubSpot deal has no line items, the scenario may fail. Use a 'Filter' before the Xero step to check if the 'Line Items' bundle is not empty.

Verification Checklist

• [ ] Run Once: Change a HubSpot deal to 'Closed Won' and check the 'Runs' tab in Make. • [ ] Verify 'Mapping': Check if the customer address in Xero matches the HubSpot Company address exactly. • [ ] Check Line Items: Ensure the Deal Total in HubSpot matches the Draft Invoice Total in Xero (check for rounding errors). • [ ] Error Test: Try syncing a deal with a missing email address to see if your Error Handler triggers correctly. • [ ] Xero Draft Status: Confirm the invoice is created as 'Draft' and not 'Authorized' to allow for final accounting review.

Ready to Automate?

Build this automation with Make.com in minutes.