From bd0ca07e50cd926a166f85355a150ebd0d7a29bf Mon Sep 17 00:00:00 2001 From: Ben White Date: Mon, 18 Nov 2024 17:30:44 -0800 Subject: [PATCH] fix: Hubspot scopes (#26264) --- posthog/models/integration.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/posthog/models/integration.py b/posthog/models/integration.py index ec876080d20..685da495735 100644 --- a/posthog/models/integration.py +++ b/posthog/models/integration.py @@ -166,7 +166,11 @@ class OauthIntegration: token_info_config_fields=["hub_id", "hub_domain", "user", "user_id"], client_id=settings.HUBSPOT_APP_CLIENT_ID, client_secret=settings.HUBSPOT_APP_CLIENT_SECRET, - scope="tickets crm.objects.contacts.write sales-email-read crm.objects.companies.read crm.objects.deals.read crm.objects.contacts.read crm.objects.quotes.read analytics.behavioral_events.send behavioral_events.event_definitions.read_write", + scope="tickets crm.objects.contacts.write sales-email-read crm.objects.companies.read crm.objects.deals.read crm.objects.contacts.read crm.objects.quotes.read", + additional_authorize_params={ + # NOTE: these scopes are only available on certain hubspot plans and as such are optional + "optional_scope": "analytics.behavioral_events.send behavioral_events.event_definitions.read_write" + }, id_path="hub_id", name_path="hub_domain", )