back to blog

Build a HubSpot AI agent workflow with Cursor and N8N

Read Time 6 mins | Written by: Cole

Build a HubSpot AI agent workflow with Cursor and N8N

Sales teams waste 21% of their day on manual tasks that automation could handle. Most developers think building HubSpot integrations requires weeks of reading API documentation, setting up complex webhooks, and debugging endless problems.

Sometimes they do, but not when you combine n8n and Cursor to build sales automation that adds and updates contacts in HubSpot.

In this 40-minute live demo, you can watch Rich, Codingscape senior software engineer, build a critical HubSpot sales agent workflow from scratch using AI-assisted coding tools. No documentation diving. No boilerplate grinding. Just natural language prompts that produce working automation.

Watch how tools like Cursor and n8n turn what used to be hours of integration work into a single focused session that delivers real value to your sales team.

Watch Hubspot automation built with Cursor and n8n

Rich doesn't build a toy demo. He constructs a sales automation that connects a custom front-end application with HubSpot. The video doesn’t have any words or explanation so it’ll only be interesting to watch if you understand the code. Otherwise, read on for the summary.

Video timeline and what’s included:

  • Environment setup & tool introduction (0-10 mins): Rich introduces the tools and sets up the foundational n8n workflow.
  • Core workflow building with n8n (10-25 mins): This is where the magic happens. Rich builds a workflow to "upsert" (update or insert) a contact in HubSpot. He configures a webhook trigger and connects it to a HubSpot node, mapping incoming data from the webhook to specific HubSpot contact properties.
  • Cursor-powered custom logic & UI (25-35 mins): Rich builds the React frontend with the help of Cursor. He asks the AI to generate a modal with a form containing fields for a prospect's information. The AI provides the necessary React code, including state management and a function to handle form submission.
  • Testing and deployment (35-40 mins): The final minutes are spent testing the full end-to-end process. Rich triggers the workflow from his application, verifies that the contact is updated in HubSpot, and confirms that the application receives a successful response from the webhook.

Now let's break down exactly how Rich leveraged each tool to achieve these results, starting with the automation engine that orchestrated the entire process.

n8n: the automation engine

n8n serves as the automation's backbone – a visual workflow platform that orchestrates the entire sales process. Rich built a workflow called "Upsert Contact" with three essential components:

  • Webhook Trigger: The workflow begins with a webhook trigger that listens for incoming data from the frontend application.

The webhook was configured to accept POST and PUT requests, allowing for both creating and updating contacts.

  • HubSpot Integration: The next step was to connect to HubSpot. A HubSpot node was added to the workflow, configured to perform an "Upsert Contact" operation. 

This node took the data received by the webhook and used it to either create a new contact in HubSpot or update an existing one. The specific contact properties mapped were First Name, Last Name, Company Name, and Email.

  • Webhook Response: A "Respond to Webhook" node was added to the end of the workflow. This node was set up to send a simple {"success": true} response back to the frontend application, providing confirmation that the operation completed successfully.

Rich drags and drops nodes to connect services, making the entire automation process easy to visualize. Tasks that normally require writing glue code and managing API credentials become an intuitive visual flow with n8n.

n8n's capabilities show their strength when Rich needs to transform data between different services. Instead of writing custom JavaScript to map HubSpot contact properties, he describes the transformation in plain English and n8n generates the code automatically.

While n8n handled the backend automation seamlessly, the frontend required a different approach. Here's where Cursor's conversational AI capabilities became the game-changer.

The user interface: React and Cursor

Rich built the frontend application using React with Material-UI components to provide a clean, professional interface. Cursor significantly accelerated the development process. Rich used Cursor to generate and refine code for a modal that included a form with fields for prospect information.

Cursor helped Rich build the key frontend logic – a function that:

  • Collects data from the form fields
  • Constructs a POST request with the form data as a JSON payload
  • Sends this request to the n8n webhook URL
  • Handles the response from the webhook to confirm success, providing instant user feedback

This powerful combination of tools allows developers to focus on the business logic and user experience rather than getting bogged down in low-level API details.

This frontend development process reveals why the Cursor + n8n combination is particularly powerful for integration work.

Why Cursor + n8n work so well together

Cursor is a go-to tool for AI-assisted development, and watching Rich use it for this HubSpot integration shows exactly why. 

Its conversational approach lets him describe complex API requirements in plain English and generate working React code in minutes.

For example, when Rich needed to handle the frontend form submission, he didn't manually write the fetch request. Instead, he used Cursor to generate code for a POST request to the n8n webhook URL. 

Cursor correctly included the necessary headers (Content-Type: application/json) and a JSON-formatted body containing the form data. This conversational approach speeds up development by eliminating the need to search for syntax or API documentation.

But the real proof of concept isn't in the individual tool capabilities – it's in watching how they fundamentally change the development approach itself.

This demo shows where AI-assisted coding actually works

Traditional development approaches would force Rich to start with HubSpot's API documentation, set up authentication flows, write webhook handlers, design database schemas, and build custom UI components. That represents 2-3 weeks of development time before having a working Hubspot automation.

Instead, watch Rich approach each requirement with natural language. He doesn't research scoring algorithms – he describes the business logic to Cursor and iterates on the generated solution in real-time. 

When the workflow needs to interact with HubSpot, he uses n8n's visual interface to connect services without writing integration code.

The breakthrough is watching Rich handle edge cases he didn't even think to mention. The AI suggests error handling for rate limits, adds logging for debugging, and includes retry logic for failed API calls, creating a more robust and reliable system.

What used to take weeks now takes 40 minutes. Rich proves that these tools don't just make development faster – they make it fundamentally different.

Want help building sales integrations with AI?

We can help you implement the same approach Rich demonstrated – combining tools like Cursor and n8n to build production-ready HubSpot automations for your sales team. 

If you need an AI-augmented team of senior software engineers to build your sales workflows and automations, we can assemble them for you in 4-6 weeks. 

It'll be faster to get started, more cost-efficient than internal hiring, and we'll deliver high-quality results quickly. Zappos, Twilio, and Veho are just a few companies that trust us to build their software and enterprise systems.

You can schedule a time to talk with us here. No hassle, no expectations, just answers.

Don't Miss
Another Update

Subscribe to be notified when
new content is published
Cole

Cole is Codingscape's Content Marketing Strategist & Copywriter.