Skip to main content
In the last chapter, we covered how to run an ActionKit Tool to execute a real-time action, like creating a HubSpot contact. In this chapter, we’ll use the ActionKit’s Triggers API to subscribe to a HubSpot webhook subscription.

Get ActionKit Triggers

Similar to the Tools API, we can get all of the available triggers for a connected user via an API call. For Triggers, we can use the GET Triggers endpoint.
fetch(`https://actionkit.useparagon.com/projects/${process.env.PARAGON_PROJECT_ID}/triggers`, {
  method: 'GET',
  headers: {Authorization: `Bearer ${SIGNED_JWT}`}
}).then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
Example response
{
  "triggers": {
    "hubspot": [
      {
        "type": "HUBSPOT_RECORD_CREATED",
        "triggerModel": "POLLING",
        "title": "New Record",
        "description": "Trigger when a new record is created in HubSpot",
        "parameters": [
          {
            "id": "recordType",
            "type": "TEXT_NO_VARS",
            "label": "Record Type",
            "required": true
          }
        ]
      }
    ]
  }
}
If you have a specific Trigger in mind, you can also visit the Triggers API docs to browse every available Trigger.

Subscribing to a Trigger

For any Trigger, call the POST /trigger-subscriptions to subscribe to any of your users’ integration events. This webhook subscription does NOT apply to all of your users with that connected integration (i.e. you will not receive webhook events from all of your user’s with a connected HubSpot account). Subscribing to a Trigger is done at a connected user level, where you can be specific in configuring subscriptions for every user.
fetch(`https://actionkit.useparagon.com/projects/${process.env.PARAGON_PROJECT_ID}/trigger-subscriptions`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${SIGNED_JWT}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    integration: 'hubspot',
    type: 'HUBSPOT_RECORD_CREATED',
    parameters: {recordType: 'Contact'},
    webhookOverride: {
      url: 'https://example.com',
      headers: {},
      metadata: {}
    }
  })
}).then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));

Receiving Webhooks

After subscribing to a Trigger, webhooks are sent to either your default webhook URL (configured in the Paragon Dashboard) OR to the URL specified in the webhookOverride parameter. A useful endpoint for seeing the schema of a webhook payload is the POST triggers/examples endpoint. This endpoint returns an example payload that takes into account your user’s custom objects and fields they may have in their connected integration.
fetch(`https://actionkit.useparagon.com/projects/${process.env.PARAGON_PROJECT_ID}/triggers/examples`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${SIGNED_JWT}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    type: 'HUBSPOT_RECORD_CREATED',
    integration: 'hubspot',
    parameters: {recordType: 'Opportunity'}
  })
}).then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
Example Payload
[
  {
    "id": "001xx000003DHP0AAO",
    "name": "Sample Opportunity",
    "amount": 50000,
    "stage": "Prospecting",
    "closeDate": "2025-12-31"
  }
]
You should now be able to subscribe to real-time webhook events like new HubSpot records. In the next chapter, we’ll bring both ActionKit Tools and Triggers together and walk through an example of an AI feature that captures HubSpot records in real-time, enriches the data with an LLM, and then writes back the data to HubSpot.