hubspot.events
ballerinax/hubspot.events Ballerina library
Overview
This is a generated connector from HubSpot OpenAPI specification.
These APIs allow accessing CRM object events.
Prerequisites
- Create a HubSpot developer account
- Obtain tokens
- Use this guide to obtain the credentials which are needed to create the <CLIENT_ID> and <CLIENT_SECRET>
Quickstart
To use the HubSpot Events connector in your Ballerina application, update the .bal file as follows:
Step 1 - Import connector
First, import the ballerinax/hubspot.event module into the Ballerina project.
import ballerinax/hubspot.event;
Step 2 - Create a new connector instance
You can now make the connection configuration using the access token.
event:ClientConfig clientConfig = { auth : { token: <ACCESS_TOKEN> } }; event:Client baseClient = check new Client(clientConfig);
Step 3 - Invoke connector operation
- List Events
event:CollectionResponseExternalUnifiedEvent|error eventList = baseClient->listEvents("contact",<OBJECT_ID>); if (eventList is event:CollectionResponseExternalUnifiedEvent) { log:printInfo("Event List " + eventList.toString()); } else { log:printInfo(msg = eventList.message()); }
- Use
bal run
command to compile and run the Ballerina program
Clients
hubspot.events: Client
This is a generated connector from HubSpot OpenAPI specification. These APIs allow accessing CRM object events.
Constructor
Gets invoked to initialize the connector
.
This is a generated connector from HubSpot OpenAPI specification. The connector initialization requires setting the API credentials.
Create a HubSpot account and obtain OAuth tokens following this guide.
During initialization you can pass either http:BearerTokenConfig if you have a bearer token or http:OAuth2RefreshTokenGrantConfig if you have Oauth tokens.
init (ConnectionConfig config, string serviceUrl)
- config ConnectionConfig - The configurations to be used when initializing the
connector
- serviceUrl string "https://api.hubapi.com" - URL of the target service
listEvents
function listEvents(string objectType, int objectId, string? occurredAfter, string? occurredBefore, string? eventType, string? after, string? before, int? 'limit, string[]? sort) returns ExternalUnifiedEventCollection|error
Returns a collection of events matching a query.
Parameters
- objectType string - The type of object being selected. Valid values are hubspot named object types (e.g.
contact
).
- objectId int - The id of the selected object. If not present, then the
objectProperty
parameter is required.
- occurredAfter string? (default ()) - The starting time as an ISO 8601 timestamp.
- occurredBefore string? (default ()) - The ending time as an ISO 8601 timestamp.
- eventType string? (default ()) - Limits the response to the specified event type. For example
&eventType=e_visited_page
returns onlye_visited_page
events. If not present all event types are returned.
- after string? (default ()) - An additional parameter that may be used to get the next
limit
set of results.
- before string? (default ()) - An additional parameter that may be used to get the next
limit
set of results.
- 'limit int? (default ()) - The maximum number of events to return, defaults to 20.
- sort string[]? (default ()) - Selects the sort field and order. Defaults to ascending, prefix with
-
for descending order.occurredAt
is the only field supported for sorting.
Return Type
- ExternalUnifiedEventCollection|error - successful operation
Records
hubspot.events: ClientHttp1Settings
Provides settings related to HTTP/1.x protocol.
Fields
- keepAlive KeepAlive(default http:KEEPALIVE_AUTO) - Specifies whether to reuse a connection for multiple requests
- chunking Chunking(default http:CHUNKING_AUTO) - The chunking behaviour of the request
- proxy ProxyConfig? - Proxy server related options
hubspot.events: ConnectionConfig
Provides a set of configurations for controlling the behaviours when communicating with a remote HTTP endpoint.
Fields
- auth BearerTokenConfig|OAuth2RefreshTokenGrantConfig - Configurations related to client authentication
- httpVersion HttpVersion(default http:HTTP_2_0) - The HTTP version understood by the client
- http1Settings ClientHttp1Settings? - Configurations related to HTTP/1.x protocol
- http2Settings ClientHttp2Settings? - Configurations related to HTTP/2 protocol
- timeout decimal(default 60) - The maximum time to wait (in seconds) for a response before closing the connection
- forwarded string(default "disable") - The choice of setting
forwarded
/x-forwarded
header
- poolConfig PoolConfiguration? - Configurations associated with request pooling
- cache CacheConfig? - HTTP caching related configurations
- compression Compression(default http:COMPRESSION_AUTO) - Specifies the way of handling compression (
accept-encoding
) header
- circuitBreaker CircuitBreakerConfig? - Configurations associated with the behaviour of the Circuit Breaker
- retryConfig RetryConfig? - Configurations associated with retrying
- responseLimits ResponseLimitConfigs? - Configurations associated with inbound response size limits
- secureSocket ClientSecureSocket? - SSL/TLS-related options
- proxy ProxyConfig? - Proxy server related options
- validation boolean(default true) - Enables the inbound payload validation functionality which provided by the constraint package. Enabled by default
hubspot.events: Error
Fields
- message string - A human readable message describing the error along with remediation steps where appropriate
- correlationId string - A unique identifier for the request. Include this value with any error reports or support tickets
- category string - The error category
- subCategory string? - A specific category that contains more specific detail about the error
- errors ErrorDetail[]? - further information about the error
- context record {}? - Context about the error condition
- links record {}? - A map of link names to associated URIs containing documentation about the error or recommended remediation steps
hubspot.events: ErrorDetail
Fields
- message string - A human readable message describing the error along with remediation steps where appropriate
- 'in string? - The name of the field or parameter in which the error was found.
- code string? - The status code associated with the error detail
- subCategory string? - A specific category that contains more specific detail about the error
- context record {}? - Context about the error condition
hubspot.events: ExternalUnifiedEvent
Used to represent any event. With this format, the objectType
and eventType
values are stringified CRM types. Example object:
{ "objectType": "CONTACT", "objectId": 208451632, "eventType": "e_visited_page", "occurredAt": 1567377501421, "id": "leviathan-be3335d3-46f1-3985-988e-ff38e6e7b9d8", "properties": { "hs_url": "https://some-website.com/", "hs_title": "Home", "hs_referrer": "https://some-other-website.com/blog/why-we-love-big-data-and-you-should-too", "hs_userAgent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36", "hs_city": "lund", "hs_region": "m", "hs_country": "se", "hs_session_id" : "leviathan-be3335d3-46f1-3985-988e-ff38e6e7b9d8", "hs_session_source" : "DIRECT" } }
Fields
- objectType string - The objectType for the object which did the event.
- objectId string - The objectId of the object which did the event.
- eventType string - The format of the
eventType
string isae{appId}_{eventTypeLabel}
,pe{portalId}_{eventTypeLabel}
, or juste_{eventTypeLabel}
for HubSpot events.
- occurredAt string - An ISO 8601 timestamp when the event occurred.
- id string - A unique identifier for the event.
- properties record {} - External event properties.
hubspot.events: ExternalUnifiedEventCollection
A collection of Events
Fields
- results ExternalUnifiedEvent[] - Array of results
- paging Paging? - Pagination data
hubspot.events: NextPage
Next Page info
Fields
- after string - Page after
- link string? - Page link
hubspot.events: OAuth2RefreshTokenGrantConfig
OAuth2 Refresh Token Grant Configs
Fields
- Fields Included from *OAuth2RefreshTokenGrantConfig
- refreshUrl string(default "https://api.hubapi.com/oauth/v1/token") - Refresh URL
hubspot.events: Paging
Pagination data
Fields
- next NextPage? - Next Page info
hubspot.events: ProxyConfig
Proxy server configurations to be used with the HTTP client endpoint.
Fields
- host string(default "") - Host name of the proxy server
- port int(default 0) - Proxy server port
- userName string(default "") - Proxy server username
- password string(default "") - Proxy server password
Import
import ballerinax/hubspot.events;
Metadata
Released date: over 1 year ago
Version: 2.3.1
License: Apache-2.0
Compatibility
Platform: any
Ballerina version: 2201.4.1
GraalVM compatible: Yes
Pull count
Total: 1
Current verison: 1
Weekly downloads
Keywords
Marketing/Event Management
Cost/Freemium
Contributors
Dependencies