- Automate onboarding kickoff
- Generate personalized welcome sequences
- Ensure consistent onboarding experience
- Provide context to success team
- Track onboarding milestones
Overview
This workflow automates the transition from sales to customer success when a deal closes. It:- Receives webhook when deal reaches “Closed Won”
- Looks up deal details with associated contacts and companies
- Gets primary contact information
- Retrieves engagement history (calls, emails, meetings)
- Uses AI to analyze relationship and create onboarding plan
- Creates timeline events with personalized next steps
- (Optional) Notifies success team
What You’ll Need
HubSpot Setup
HubSpot Workflow (to trigger onboarding):- Trigger: Deal stage changed to “Closed Won”
- Action: Send webhook to Agent.AI
- Payload includes:
deal_id
,deal_name
,deal_amount
,close_date
- Read Deals
- Read Contacts
- Read Companies
- Read Engagements
- Write Timeline Events
- Custom deal properties for onboarding tracking
- Onboarding status field
- Implementation timeline field
Agent.AI Setup
Actions needed:- Webhook Trigger
- Lookup HubSpot Object (V2) - Used multiple times
- Get Engagements (V2) - Used multiple times
- Invoke LLM
- Create Timeline Event (V2) - Used multiple times
- If Condition (optional, for conditional logic)
- LLM access (OpenAI, Anthropic, etc.)
Step-by-Step Setup
Step 1: Create the Agent.AI Workflow
Add trigger: Webhook Configuration:- Copy the webhook URL (you’ll need this for HubSpot)
- Expected variables from HubSpot:
_hubspot_portal
(automatically included)deal_id
(deal’s HubSpot ID)deal_name
(deal name for context)deal_amount
(contract value)close_date
(when deal closed)
Step 2: Setup HubSpot Workflow
In HubSpot:- Go to Automation → Workflows
- Create workflow
- Trigger: Deal stage changed to “Closed Won”
- Add action: Send webhook
- Webhook URL: Paste Agent.AI webhook URL from Step 1
- Method: POST
- Payload:
- Save and activate
Step 3: Lookup Deal with Associations
Add action: Lookup HubSpot Object (V2) Configuration:- Object Type: Deals
- Lookup by: Lookup by Object ID
- Object ID: Click
{}
→ selectdeal_id
(from webhook) - Retrieve Properties: Click ”+ Add Property” and select:
dealname
dealstage
amount
closedate
pipeline
deal_type
contract_start_date
hs_object_id
- Retrieve Associations: Select “Contacts” and “Companies”
- Output Variable:
deal_data
Step 4: Lookup Primary Contact
Add action: Lookup HubSpot Object (V2) Configuration:- Object Type: Contacts
- Lookup by: Lookup by Object ID
- Object ID: Click
{}
→deal_data
→associations
→contacts
→[0]
→id
- Retrieve Properties: Click ”+ Add Property” and select:
firstname
lastname
email
phone
jobtitle
department
hs_object_id
- Output Variable:
primary_contact
[0]
gets the first contact from the associations array. You could add an If Condition to find a specific contact role instead.
Step 5: Get Deal Engagement History
Add action: Get Engagements (V2) Configuration:- Object Type: Deals
- Object ID: Click
{}
→ selectdeal_id
(from webhook) - Engagement Types: Select “Calls”, “Emails”, “Meetings”, “Notes”
- Limit: 50
- Output Variable:
deal_engagements
Step 6: Get Contact Engagement History
Add action: Get Engagements (V2) Configuration:- Object Type: Contacts
- Object ID: Click
{}
→primary_contact
→id
- Engagement Types: Select “Calls”, “Emails”, “Meetings”, “Notes”
- Limit: 50
- Output Variable:
contact_engagements
Step 7: AI Onboarding Analysis
Add action: Invoke LLM Configuration:- Prompt:
- Model: gpt-4 (or your preferred LLM)
- Output Variable:
onboarding_plan
Step 8: Create Kickoff Timeline Event
Add action: Create Timeline Event (V2) Configuration:- Object Type: Deals
- Target Object ID: Click
{}
→ selectdeal_id
- Event Type:
onboarding_kickoff
- Event Title: “Onboarding Plan Generated”
- Event Description: Click
{}
→onboarding_plan
→welcome_message
- Event Properties:
- Output Variable:
kickoff_event
Step 9: Create Milestone Events (Loop Optional)
Add action: Create Timeline Event (V2) - Repeat for each milestone Milestone 1:- Object Type: Deals
- Target Object ID: Click
{}
→ selectdeal_id
- Event Type:
onboarding_milestone
- Event Title: “Milestone 1: ” then click
{}
→onboarding_plan
→milestones
→[0]
- Event Description: Type “First milestone for customer onboarding”
- Output Variable:
milestone_1_event
- Same pattern, using
milestones[1]
- Same pattern, using
milestones[2]
Step 10: Create Contact Timeline Event
Add action: Create Timeline Event (V2) Configuration:- Object Type: Contacts
- Target Object ID: Click
{}
→primary_contact
→id
- Event Type:
customer_onboarding_start
- Event Title: “Customer Onboarding Started”
- Event Description: Type “Onboarding kickoff for ” then click
{}
→deal_data
→properties
→dealname
- Event Properties:
- Output Variable:
contact_event
Step 11 (Optional): Send Notification
Add action: Send Email Configuration:- To: [email protected]
- Subject: Type “New Customer Onboarding: ” then click
{}
→ selectdeal_name
- Body:
How It Works
Execution flow:- Deal closes in HubSpot → reaches “Closed Won” stage
- HubSpot workflow fires webhook to Agent.AI with deal ID
- Lookup Deal gets full deal details + associated contact/company IDs →
deal_data
- Lookup Primary Contact gets contact details →
primary_contact
- Get Deal Engagements retrieves sales history →
deal_engagements
- Get Contact Engagements retrieves contact history →
contact_engagements
- AI Analysis combines all context → generates onboarding plan →
onboarding_plan
- Create Timeline Events logs kickoff + milestones to deal and contact
- Send Email (optional) notifies success team
Example Output
What the AI Generates
For “Acme Corp - Enterprise License” deal:What Appears in HubSpot
On the Deal timeline:- Event: “Onboarding Plan Generated”
- Description: “Welcome to Acme Corp! This is a high-value enterprise customer…”
- Properties: complexity=High, timeline_days=90
- “Milestone 1: Week 1-2: Kickoff call, technical discovery, SSO setup”
- “Milestone 2: Week 3-6: Core implementation, API integration…”
- “Milestone 3: Week 7-12: Testing, training sessions…”
- Event: “Customer Onboarding Started”
- Description: “Onboarding kickoff for Acme Corp - Enterprise License”
Customization Ideas
Different Trigger Conditions
In HubSpot workflow:- Trigger on specific deal types only (enterprise vs. standard)
- Trigger when ticket type = “New Customer Onboarding”
- Trigger when deal reaches “Implementation” stage
Conditional Onboarding Paths
Add If Condition after AI analysis:- If complexity = “High” → Assign to senior success manager
- If complexity = “Low” → Use automated onboarding sequence
- If deal amount > $100k → Create dedicated Slack channel
Company-Level Analysis
Add step to lookup company:- Get company details from
deal_data.associations.companies[0].id
- Include company size, industry, tech stack in AI analysis
- Adjust onboarding based on company profile
Integration with Other Systems
After onboarding plan:- Create Jira tickets for technical milestones
- Add tasks to project management tool
- Create Slack channel for customer
- Send calendar invites for milestone meetings
Multi-Contact Analysis
Instead of just primary contact:- Loop through all associated contacts
- Get engagements for each
- Identify decision makers, technical champions, end users
- Create onboarding plan for each role
Troubleshooting
No Associated Contacts
Deal has no contacts associated Causes:- Deal created without contact association
- Contact association removed
- Add If Condition after Step 3 to check if
deal_data.associations.contacts
exists - If empty, skip contact lookup and use deal-only onboarding
- Or create timeline event flagging missing contact
Engagement History Empty
No engagements returned Causes:- Deal/contact has no logged engagements
- Permissions issue
- Check “Read Engagements” permission
- Add fallback message: “No engagement history available”
- AI can still create onboarding plan without history
- Log note to manually research customer
AI Response Too Generic
Onboarding plan lacks specifics Causes:- Limited engagement history
- Prompt not specific enough
- Missing key context
- Add more specific prompts about what to look for
- Include additional data sources (timeline events, notes)
- Ask AI to highlight unknowns or gaps
- Request specific questions for kickoff call
Timeline Events Not Creating
Events fail to create Causes:- Missing permissions
- Event type name invalid
- Target object ID wrong
- Verify “Write Timeline Events” permission
- Use lowercase with underscores for event type
- Check execution log for exact error
- Verify object IDs are correct
Tips & Best Practices
✅ Do:- Test with closed-won test deals first
- Include engagement limit (50 is reasonable)
- Create distinct event types for each milestone
- Log events to both deal and contact
- Include complexity assessment
- Provide success team with full context
- Track which engagements matter most (demos, technical calls)
- Assume primary contact is always first in array (add validation)
- Skip error handling for missing associations
- Create generic onboarding plans (use specific context)
- Forget to notify success team
- Overwhelm with too many timeline events
- Include sensitive sales notes in onboarding plan
- Engagement retrieval is fast (under 2 seconds)
- LLM analysis takes 5-10 seconds with full context
- Consider limiting engagement count for very old deals
- Cache onboarding templates for common scenarios
- Time from deal close to onboarding kickoff
- Onboarding completion rate by complexity level
- Accuracy of AI timeline predictions
- Success team satisfaction with plan quality
Related Resources
Actions used: Related workflows:- HubSpot Deal Analysis - Similar AI analysis with loops
- HubSpot Contact Enrichment - Webhook-triggered automation
Last Updated: 2025-10-01