Skip to content

Commit

Permalink
Source Hubspot: web analytics streams as an experimental feature
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-yermilov-gl committed Dec 4, 2023
1 parent 94d3da9 commit 1589260
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 16 deletions.
Expand Up @@ -142,20 +142,26 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]:
Tickets(**common_params),
TicketPipelines(**common_params),
Workflows(**common_params),
ContactsWebAnalytics(**common_params),
CompaniesWebAnalytics(**common_params),
DealsWebAnalytics(**common_params),
TicketsWebAnalytics(**common_params),
EngagementsCallsWebAnalytics(**common_params),
EngagementsEmailsWebAnalytics(**common_params),
EngagementsMeetingsWebAnalytics(**common_params),
EngagementsNotesWebAnalytics(**common_params),
EngagementsTasksWebAnalytics(**common_params),
GoalsWebAnalytics(**common_params),
LineItemsWebAnalytics(**common_params),
ProductsWebAnalytics(**common_params),
]

enable_experimental_streams = "enable_experimental_streams" in config and config["enable_experimental_streams"]

if enable_experimental_streams:
streams.extend([
ContactsWebAnalytics(**common_params),
CompaniesWebAnalytics(**common_params),
DealsWebAnalytics(**common_params),
TicketsWebAnalytics(**common_params),
EngagementsCallsWebAnalytics(**common_params),
EngagementsEmailsWebAnalytics(**common_params),
EngagementsMeetingsWebAnalytics(**common_params),
EngagementsNotesWebAnalytics(**common_params),
EngagementsTasksWebAnalytics(**common_params),
GoalsWebAnalytics(**common_params),
LineItemsWebAnalytics(**common_params),
ProductsWebAnalytics(**common_params),
])

api = API(credentials=credentials)
if api.is_oauth2():
authenticator = api.get_authenticator()
Expand All @@ -175,11 +181,14 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]:
self.logger.info("No scopes to grant when authenticating with API key.")
available_streams = streams

custom_objects_streams = list(self.get_custom_object_streams(api=api, common_params=common_params))
available_streams.extend(self.get_custom_object_streams(api=api, common_params=common_params))

custom_objects_web_analytics_streams = self.get_web_analytics_custom_objects_stream(custom_objects_streams, common_params=common_params)
available_streams.extend(custom_objects_web_analytics_streams)
if enable_experimental_streams:
custom_objects_web_analytics_streams = self.get_web_analytics_custom_objects_stream(
custom_object_stream_instances=self.get_custom_object_streams(api=api, common_params=common_params),
common_params=common_params
)
available_streams.extend(custom_objects_web_analytics_streams)

return available_streams

Expand Down
Expand Up @@ -86,6 +86,11 @@ connectionSpecification:
if you need help finding this token.
type: string
airbyte_secret: true
enable_experimental_streams:
title: Enable experimental streams
description: If enabled then experimental streams become available for sync.
type: boolean
default: false
advanced_auth:
auth_flow_type: oauth2.0
predicate_key:
Expand Down
22 changes: 21 additions & 1 deletion docs/integrations/sources/hubspot.md
Expand Up @@ -163,10 +163,22 @@ The HubSpot source connector supports the following streams:
- [Tickets](https://developers.hubspot.com/docs/api/crm/tickets) \(Incremental\)
- [Ticket Pipelines](https://developers.hubspot.com/docs/api/crm/pipelines) \(Client-Side Incremental\)
- [Workflows](https://legacydocs.hubspot.com/docs/methods/workflows/v3/get_workflows) \(Client-Side Incremental\)
- [ContactsWebAnalytics](https://developers.hubspot.com/docs/api/events/web-analytics) \(Client-Side Incremental\)
- [CompaniesWebAnalytics](https://developers.hubspot.com/docs/api/events/web-analytics) \(Client-Side Incremental\)
- [DealsWebAnalytics](https://developers.hubspot.com/docs/api/events/web-analytics) \(Client-Side Incremental\)
- [TicketsWebAnalytics](https://developers.hubspot.com/docs/api/events/web-analytics) \(Client-Side Incremental\)
- [EngagementsCallsWebAnalytics](https://developers.hubspot.com/docs/api/events/web-analytics) \(Client-Side Incremental\)
- [EngagementsEmailsWebAnalytics](https://developers.hubspot.com/docs/api/events/web-analytics) \(Client-Side Incremental\)
- [EngagementsMeetingsWebAnalytics](https://developers.hubspot.com/docs/api/events/web-analytics) \(Client-Side Incremental\)
- [EngagementsNotesWebAnalytics](https://developers.hubspot.com/docs/api/events/web-analytics) \(Client-Side Incremental\)
- [EngagementsTasksWebAnalytics](https://developers.hubspot.com/docs/api/events/web-analytics) \(Client-Side Incremental\)
- [GoalsWebAnalytics](https://developers.hubspot.com/docs/api/events/web-analytics) \(Client-Side Incremental\)
- [LineItemsWebAnalytics](https://developers.hubspot.com/docs/api/events/web-analytics) \(Client-Side Incremental\)
- [ProductsWebAnalytics](https://developers.hubspot.com/docs/api/events/web-analytics) \(Client-Side Incremental\)

### Custom CRM Objects

Custom CRM Objects will appear as streams available for sync, alongside the standard objects listed above.
Custom CRM Objects and Custom Web Analytics will appear as streams available for sync, alongside the standard objects listed above.

If you set up your connections before April 15th, 2023 (on Airbyte Cloud) or before 0.8.0 (OSS) then you'll need to do some additional work to sync custom CRM objects.

Expand All @@ -179,6 +191,14 @@ First you need to give the connector some additional permissions:

Then, go to the replication settings of your connection and click **refresh source schema** to pull in those new streams for syncing.

<FieldAnchor field="enable_experimental_streams" />

### Experimental streams

[Web Analytics](https://developers.hubspot.com/docs/api/events/web-analytics) streams may be enabled as an experimental feature but please note that they are based on API which is currently in beta and may change at some point of time or be unstable.

</FieldAnchor>

### Notes on the `engagements` stream

1. Objects in the `engagements` stream can have one of the following types: `note`, `email`, `task`, `meeting`, `call`. Depending on the type of engagement, different properties are set for that object in the `engagements_metadata` table in the destination:
Expand Down

0 comments on commit 1589260

Please sign in to comment.