Example
What you'll build
Build a WSO2 Integrator automation that connects to the HubSpot CRM Commerce Discounts API and retrieves all discount objects. The integration uses an Automation entry point to call the List operation and logs the results as JSON.
Operations used:
- List : Retrieves all discount objects from your HubSpot CRM account
Architecture
Prerequisites
- A HubSpot account with API access
- A HubSpot private app token with CRM scopes for commerce discounts
Setting up the HubSpot CRM Commerce Discounts 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 CRM Commerce Discounts connector
Step 1: Open the connector palette and search for the HubSpot CRM Commerce Discounts connector
- In the Design view, select Add Artifact and select Connection.
- The connector palette opens. Use the search field to find the connector.
- Search for
hubspot.crm.commerce.discountsin the search field. - Select the HubSpot CRM Commerce Discounts connector from the results.
Configuring the HubSpot CRM Commerce Discounts connection
Step 2: Fill in the connection parameters and save the connection
Bind each field to a configurable variable so credentials stay out of your source code.
- Connection Name : Enter
discountsClient - Config : Reference a configurable variable
hubspotAuthTokenthat holds your HubSpot API token - Service Url : Reference a configurable variable
hubspotServiceUrlfor the API base URL
Select Save to create the connection.
Step 3: Set actual values for your configurables
- In the left panel, select Configurations.
- Set a value for each configurable listed below.
- hubspotServiceUrl (string) : The base URL for the HubSpot Commerce Discounts API
- hubspotAuthToken (string) : Your HubSpot private app API token
Configuring the HubSpot CRM Commerce Discounts List operation
Step 4: Add an Automation entry point
- Select Add Artifact in the Design section.
- Select Automation from the artifacts list.
- Select Create to add the automation entry point.
Step 5: Select the List operation and configure it
- In the Automation flow canvas, select the + button after the Start node to open the step panel.
- Expand the discountsClient connection under the Connections section to see available operations.
- Select the List operation.
- The operation configuration form appears. This operation has no required parameters. Set the Result variable name to
listResult. - Select Save.
Try it yourself
Try this sample in WSO2 Integration Platform.
More code examples
The HubSpot CRM Commerce Discounts connector provides practical examples illustrating usage in various scenarios. Explore these examples, covering the following use cases:
- Discount Manager - see how the HubSpot API can be used to create discount and manage it through endpoints.
- Festival Discounts - see how the HubSpot API can be used to create and to manage multiple discounts at a time.





