Skip to main content
In this final chapter, we’ll build an automated HubSpot agent together. Our HubSpot agent uses:
  1. Triggers to run the agent whenever a new HubSpot record is created
  2. Tools for the agent to get, create, and update HubSpot data if it’s relevant to the user’s prompt template.

1. Authenticate our User and Connect their HubSpot Integration

First we’ll generate a Paragon-signed JWT for our user that we’ll use client-side with the Paragon SDK.
server-side function
Then we can use the Paragon SDK to authenticate and connect our user’s HubSpot account.
calling our backend route to retrieve our JWT before authenticating
Paragon.connect to bring up the Connect Portal

2. Let our Users Configure their HubSpot Event Subscription

Using the GET triggers endpoint, we can let our users select the type of HubSpot event they’d like their agent to receive.
Gets the available Triggers for our specific user
Use the Triggers response to surface configurations to our user
After the user selects a Trigger and configures it, we can subscribe to that user’s HubSpot events.
Subscribes to the Trigger

3. Kick Off an Agent with Tools Whenever a New Event Fires

Whenever a new HubSpot event occurs (new record, updated record, deleted record), Triggers will send a webhook to our process.env.WEBHOOK_ENDPOINT. That endpoint will kick off an agent with HubSpot Tools for followup work. In the screenshot above, the custom prompt was:
Our automated agent should use the HUBSPOT_CREATE_ENGAGEMENT Tool to perform its task. First let’s get pre-built tools for our agent using ActionKit’s Tools API.
Get ActionKit Tools
Next, we’ll format these Tools per Vercel’s ai-sdk specifications for their agent (you can format Tools for Vercel, LangChain, or any LLM API directly).
Now we can provide our ai-sdk agent with the formatted Tools.
We now have a fully reactive agent that fires around the clock, using:
  1. Triggers to “prompt” the agent to work whenever our users have their configured event fire
  2. Tools to give our agent integration tools that can write back to the triggered integration or any other Paragon integration