ballerinax/trigger.hubspot Ballerina library

0.9.0

Overview

The Ballerina listener for Hubspot allows you to listen to the following events in a HubSpot account.

  • onCompanyCreation
  • onCompanyDeletion
  • onCompanyPropertyChange
  • onContactCreation
  • onContactDeletion
  • onContactPropertyChange
  • onConversationCreation
  • onConversationDeletion
  • onConversationPropertyChange
  • onDealCreation
  • onDealDeletion
  • onDealPropertyChange

Prerequisites

Before using this connector in your Ballerina application, complete the following:

  • Create HubSpot account
  • Create an application in the Developer Portal.
  • Go to webhooks and register a targetURL for notifications.
  • Create a subscription with required events.

Quickstart

To use the HubSpot listener in your Ballerina application, update the .bal file as follows:

Step 1: Import listener

To import the ballerinax/trigger.hubspot module into the Ballerina project, add the following statement:

Copy
import ballerinax/trigger.hubspot;

Step 2: Create a new listener instance

To create a listenerConfig with the application secret and the callback URL, add the following configuration.

Copy
listener hubspot:Listener hubspotWebhook = new(listenerConfig = {clientSecret, callbackURL});

Note You can obtain the clientSecret from the HubSpot portal.

Step 3: Invoke listener triggers

Now let's use the triggers available within the listener.

For example, you can configure the Ballerina listener to listen to company creation and deletion events as follows:

Listen to HubSpot Company Creation and Deletion

```ballerina
    service hubspot:CompanyService on hubspotWebhook {
        remote function onCompanyCreation(hubspot:WebhookEvent event) returns error? {
            io:println(event);
        }

        remote function onCompanyDeletion(hubspot:WebhookEvent event) returns error? {
            io:println(event);
        }
    }
```

Note: The event payload does not contain metadata related to the event. You need to use the specific HubSpot client to obtain it.

To compile and run the Ballerina program, issue the following command:

bal run

Import

import ballerinax/trigger.hubspot;Copy

Metadata

Released date: 11 months ago

Version: 0.9.0

License: Apache-2.0


Compatibility

Platform: any

Ballerina version: 2201.4.1

GraalVM compatible: Yes


Pull count

Total: 131

Current verison: 3


Weekly downloads


Source repository


Keywords

Sales & CRM/Customer Relationship Management

Cost/Freemium

Trigger


Contributors

Other versions