Webhook Triggers
Connect HubSpot workflows to Agent.AI using webhooks - automatically trigger Agent.AI workflows when things happen in HubSpot. Common uses:- Run enrichment when contact is created
- Start onboarding when deal closes
- Update records when properties change
- Trigger analysis when stage changes
- Send notifications on specific events
What This Does (The Simple Version)
Think of webhooks as a doorbell. When something happens in HubSpot (contact created, deal closed, etc.), HubSpot “rings the doorbell” by sending a webhook to Agent.AI. This starts your Agent.AI workflow automatically. Real-world example: When a new contact is added to HubSpot, you want to automatically enrich them with company data. Set up a HubSpot workflow that sends a webhook to Agent.AI whenever “Contact Created” happens. Agent.AI receives the webhook and runs your enrichment workflow.How It Works
Two parts:- HubSpot Workflow - Watches for events (contact created, deal updated, etc.) and sends webhook
- Agent.AI Workflow - Receives webhook and runs your automation
- Event happens in HubSpot (e.g., deal closes)
- HubSpot workflow triggers
- HubSpot sends webhook (HTTP POST) to Agent.AI
- Agent.AI workflow starts with data from webhook
- Agent.AI runs your actions
- Updates go back to HubSpot
Setting It Up
Part 1: Create Agent.AI Workflow with Webhook Trigger
Step 1: Start new workflow in Agent.AI- Click “Create Workflow”
- Add trigger: Webhook
- Copy the webhook URL (looks like:
https://agent.ai/webhook/abc123
)
contact_id
- Contact’s HubSpot ID (required)contact_email
- Email addresscontact_company
- Company name- Any other contact properties
deal_id
- Deal’s HubSpot ID (required)deal_name
- Deal namedeal_amount
- Deal amountdeal_stage
- Current stage- Any other deal properties
company_id
- Company’s HubSpot ID (required)company_name
- Company namecompany_domain
- Domain- Any other company properties
_hubspot_portal
- Identifies which HubSpot account sent it
Part 2: Create HubSpot Workflow that Sends Webhook
Step 1: Go to HubSpot Automation- In HubSpot, go to Automation → Workflows
- Click Create workflow
- Choose From scratch
- Contact-based: “Contact is created”, “Contact property changed”
- Deal-based: “Deal stage changed”, “Deal is created”
- Company-based: “Company is created”, “Company property changed”
- Click + to add action
- Search for “webhook”
- Select Send a webhook
- Click Add action
- Paste the Agent.AI webhook URL from Part 1
- Select POST
- Select JSON
- Click Save
- Toggle to On (activate workflow)
- Test by creating a test record that matches trigger
Common Webhook Patterns
Contact Enrichment on Creation
HubSpot trigger: Contact is created Webhook payload:- Lookup contact details
- Web search for company
- AI enrichment analysis
- Update contact with insights
Deal Onboarding on Close
HubSpot trigger: Deal stage is “Closed Won” Webhook payload:- Lookup deal + associations
- Get engagement history
- AI onboarding plan
- Create timeline events
Lead Scoring on Update
HubSpot trigger: Contact property “Job Title” is known Webhook payload:- Lookup full contact
- Calculate lead score
- Update contact with score
- If high score → notify sales
Testing Your Webhook
Test in Agent.AI First
Before connecting to HubSpot:- Go to your Agent.AI workflow
- Click Test or Run
- Manually enter test webhook data
- Verify workflow runs correctly
Test HubSpot Workflow
After connecting:- In HubSpot workflow, click Test
- Select a test record (contact, deal, etc.)
- Click Test action
- HubSpot sends webhook to Agent.AI
- Check Agent.AI execution log
Check Execution Log
In Agent.AI:- Go to workflow
- View Executions or History
- See webhook data received
- Check if all variables arrived
- Debug any issues
Troubleshooting
Webhook Not Triggering
Agent.AI workflow doesn’t run Possible causes:- HubSpot workflow not activated
- Test record doesn’t match trigger criteria
- Webhook URL incorrect
- Check HubSpot workflow is On
- Verify trigger conditions match test record
- Copy/paste webhook URL again from Agent.AI
- Check HubSpot workflow history for errors
Variables Missing in Agent.AI
Webhook arrives but variables are empty Possible causes:- Property not populated in HubSpot
- Wrong property name in payload
- Syntax error in JSON
- Check HubSpot record has those properties filled
- Verify exact property names (case-sensitive)
- Test JSON payload in HubSpot workflow test mode
- View Agent.AI execution log to see what was received
Wrong Portal ID
Workflow runs but can’t access HubSpot Possible causes:_hubspot_portal
missing from payload- Not connected to correct HubSpot account
- Always include
"_hubspot_portal": "{{portal.id}}"
in payload - Verify correct HubSpot account connected in Agent.AI
HubSpot Shows Webhook Error
HubSpot workflow shows webhook action failed Possible causes:- Agent.AI webhook URL changed
- Agent.AI workflow deleted
- Network issue
- Get fresh webhook URL from Agent.AI
- Update in HubSpot workflow
- Test again
- Check Agent.AI workflow still exists
Tips & Best Practices
✅ Do:- Always include
_hubspot_portal
in payload - Always include object ID (contact_id, deal_id, etc.)
- Test with sample records first
- Use descriptive variable names
- Keep payload simple - only essential properties
- Check execution logs after testing
- Use HubSpot workflow test mode
- Send entire object (only needed properties)
- Forget to activate HubSpot workflow
- Use webhooks for batch operations (use scheduled instead)
- Assume properties are always filled
- Include sensitive data in webhook
- Create circular webhooks (Agent.AI → HubSpot → Agent.AI)
- Webhooks trigger instantly (under 1 second)
- Agent.AI workflow starts immediately
- Total time depends on actions inside workflow
- Typical enrichment: 5-15 seconds end-to-end
- Use
{{object.hs_object_id}}
for object ID - Use
{{portal.id}}
for portal ID - Property names match HubSpot internal names
- Use
{{property.original}}
for old value - Use
{{property.updated}}
for new value
Related Resources
Workflow examples using webhooks:- Contact Enrichment - Webhook on contact created
- Customer Onboarding - Webhook on deal closed
- HubSpot Setup - Initial connection setup
- Template Variables - Using
{{variables}}
in Agent.AI - Troubleshooting - Common webhook issues
- Lookup HubSpot Object (V2) - Get full object details
- Update HubSpot Object (V2) - Update after processing
Last Updated: 2025-10-01