Example
What you'll build
Build an integration that connects to the HubSpot Marketing Events API and creates a marketing event programmatically. The integration uses an Automation entry point to trigger the operation and returns a MarketingEventDefaultResponse confirming the event was created.
Operations used:
- postEventsCreate : Creates a new marketing event in HubSpot with details such as event name, organizer, and external identifiers
Architecture
Prerequisites
- A HubSpot developer account with a Private App bearer token that has the
crm.objects.marketing_events.writescope
Setting up the HubSpot marketing events integration
New to WSO2 Integrator? Follow the Create a New Integration guide to set up your integration first, then return here to add the connector.
Adding the HubSpot marketing events connector
Step 1: Open the connector palette
Select + Add Artifact → Connection from the Integration overview canvas to open the connector palette.
Step 2: Search for and select the connector
- Enter
hubspot marketing eventsin the search box. - Select the connector card labelled "Events / ballerinax / hubspot.marketing.events".
Configuring the HubSpot marketing events connection
Step 3: Fill in the connection parameters
In the Add Connection form, bind the connection parameters to configurable variables:
- Select the Config field to open the Record Configuration modal.
- Expand auth → BearerTokenConfig.
- Select + New Configurable next to the
tokenfield, name ithubspotBearerToken(type:string), and select Save Configurable. - Enter
eventsClientin the Connection Name field.
- Config : Connector configuration holding the bearer token authentication details, bound to the
hubspotBearerTokenconfigurable variable - Connection Name : Logical name for the connection instance
Step 4: Save the connection
Select Save Connection to persist the connection. The integration canvas shows the eventsClient connection node, and the left sidebar lists it under Connections → eventsClient.
Step 5: Set actual values for your configurables
- In the left panel, select Configurations.
- Set a value for each configurable listed below.
- hubspotBearerToken (string) : Your HubSpot Private App bearer token with the
crm.objects.marketing_events.writescope
Configuring the HubSpot marketing events postEventsCreate operation
Step 6: Add an automation entry point
- Select + Add Artifact on the canvas.
- Select Automation from the artifact picker.
- Accept the default settings and select Create.
The automation flow is created with a Start node and an Error Handler node.
Step 7: Select and configure the postEventsCreate operation
- Select the + button between the Start and Error Handler nodes to open the node panel.
- Select eventsClient under the Connections section to expand it and reveal all available operations.
- Select Post Events Create to open the configuration panel.
- Switch to the Expression tab for the Payload field and enter your event details.
- Payload :
MarketingEventCreateRequestParamsrecord containing the event details; required fields includeexternalAccountId,eventOrganizer,externalEventId, andeventName - Result : Variable name for the returned
events:MarketingEventDefaultResponse; defaults toeventsMarketingeventdefaultresponse
- Select Save to add the operation to the automation flow.
Try it yourself
Try this sample in WSO2 Integration Platform.
More code examples
The HubSpot Marketing Events connector provides practical examples illustrating usage in various scenarios. Explore these examples, covering the following use cases:
- Event Participation Management: Use Marketing Event API to Manage and Update Participants seamlessly.
- Marketing Event Management: Create, update and manage multiple Marketing Events and automate event management.





