# Send a GitBook onboarding kit when a HubSpot deal closes won

> The moment a deal hits closed won, draft a warm welcome email in Gmail with the 3 to 5 GitBook pages that actually fit what they bought.

- Workflow type: agent
- Services: HubSpot, GitBook, Gmail
- Categories: Sales, Customer Support
- Published: 2026-06-26

## What it does

- Watches HubSpot for deals that move into your closed won stage and kicks off the moment one lands.
- Reads the deal, the primary contact, and the company so the email knows who it is talking to and what they bought.
- Searches your GitBook for the few pages that actually match the customer's use case and product line, and skips the generic stuff.
- Drafts a short, warm welcome in Gmail from the deal owner with a curated Start Here list, and leaves it as a draft so a human can review before it sends.

## What you'll need

- A HubSpot account with permission to read deals, contacts, and companies, and to receive a webhook when deal stages change.
- A GitBook workspace with the docs you want customers to read first.
- A Gmail account for the account executive or CSM who should appear as the sender of the draft.

## Prompt

Build me an agent workflow that turns every closed-won HubSpot deal into a personalized onboarding email, drafted from our GitBook docs, ready for the AE or CSM to review and send.

Trigger: a HubSpot webhook on deal property change. Fire when a deal's stage moves into our closed-won stage (let me configure which pipeline and stage qualifies). Ignore stage changes that don't land on closed won.

When it fires, the agent should:

1. Use HubSpot Get Deal on the deal ID from the webhook, requesting associations to the company and the primary contact, plus deal properties that describe what they bought (product line or line items, amount, segment, and any free-text notes that describe their use case).

2. Use HubSpot Get Company on the associated company to pull industry, size, and any segment or vertical fields we track. Pull the primary contact's first name, last name, and email from the contact association.

3. From all of that, synthesize a short internal picture of the customer: who they are, what they bought, and the specific use case in their own words where possible.

4. Use GitBook Search Site Content against our docs site to find candidate onboarding pages. Run a few targeted searches keyed off the product line, the use case, and the segment, not one broad query. For the top hits, call GitBook Get Page By ID to confirm the page actually matches before recommending it. Pick the 3 to 5 pages that best fit this customer, and explicitly skip generic content that doesn't apply to what they bought.

5. Use Gmail Create a Draft, sent from the deal owner's Gmail account, addressed to the primary contact. The email should be short and warm: a one-sentence congrats and intro that references their use case in their own words, then a curated Start Here list of the chosen GitBook pages. Each link gets one sentence on why that specific page matters for this customer. Close with an offer to help and the AE's signature.

Leave the email as a draft in the AE's Gmail. Do not auto-send. The whole point is that the AE or CSM does a quick read, tweaks anything off, and sends it themselves.

Edge cases: if the deal has no primary contact, no company, or no use case context at all, skip drafting and flag it instead of sending a generic email. If GitBook search returns nothing relevant, do the same. I would rather miss one than send a bad first impression.

Make the closed-won stage, the pipeline, the GitBook site to search, the sender mailbox, and the tone of the email configurable when I set this up.

## How to customize

- Change which HubSpot pipeline or stage counts as closed won, or limit it to certain product lines or deal sizes.
- Tell the agent which sections of your GitBook to favor (getting started, integrations, admin) and which to ignore.
- Tune the tone, length, and signature of the welcome email, or send it from a shared inbox instead of the deal owner.

## FAQ

### Does the email send automatically?

No. The agent leaves a draft in the sender's Gmail so the account executive or CSM can read it, tweak anything, and hit send. That keeps a human in the loop on the first message a new customer sees.

### How does it pick the right GitBook pages?

It searches your GitBook using what it learned from the deal, like the product line bought, the segment, and any use case notes on the deal or contact. It then opens the top hits to confirm they actually fit, and drops anything generic that doesn't match.

### Will it work if my deal stages are named differently?

Yes. When you set it up, you tell it which pipeline and which stage means closed won for you, so it works with custom HubSpot stage names.

### Who does the email come from?

By default, the deal owner in HubSpot. You can also point it at a shared mailbox or a specific CSM so every new customer hears from the same person.

### What if a closed won deal is missing a primary contact or use case notes?

The agent will skip drafting and flag the deal instead of sending a half-baked email. You can adjust that behavior, for example to fall back to a generic welcome, when you build the workflow.

Use this prompt in General Input: https://www.generalinput.com/prompts/send-a-gitbook-onboarding-kit-when-a-hubspot-deal-closes-won