:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(integrations): add request access flow for non-admin members (#64401)
Rafael Audibert0622fb80e1d1
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 9867f5446bcb..f9ccc9f30b78 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -6732,6 +6732,10 @@ snapshots:hash: v1.k794b7964.7012e3f23570ed0bdf0af3b947fa8b09bb1a40edd59928bea76c9472eef444a1.yWbx-kU4Sx_plVguU1neQn8eHFiPseBMjmr8tCiy6O0scenes-other-integration-landing-page--connected--light:hash: v1.k794b7964.ecea4a3cebed2c5fba619695c4ca576cfa0ce3a9a818af498791c1080be2675e.nkq28LhIVvheqMxYLdV5Od1eeCXKI1AFgIKfcbUOAEw+ scenes-other-integration-landing-page--no-permission--dark:+ hash: v1.k794b7964.a17a0acea1830a870a6ff984cc5c523497f678d8c8413f3fef8ea2a470eb8d43.yjPhd5PJM817w4ybixhkzCHCR0Gq_Qtp9EyGUehuunM+ scenes-other-integration-landing-page--no-permission--light:+ hash: v1.k794b7964.f4e806a53bd611cbfab6c96c8a53d0fc5754cb922328953e32028fcfac971f78.Fhy7_1HTcf09dpHknO0udUiW_B_1kNWLU6JVuOIj4lgscenes-other-integration-landing-page--not-connected--dark:hash: v1.k794b7964.cbc1efc83f9f31ee7ed22a7da2be3ec19e7e6f6568a5b43ade5f75ee4aaccbc5.u1nKAJkTALr_RPPMm4EA68pFFF4JE03AJBqWleTvbJkscenes-other-integration-landing-page--not-connected--light:diff --git a/frontend/src/lib/components/RestrictedArea.tsx b/frontend/src/lib/components/RestrictedArea.tsxindex fd4a795712de..deb43bcc95d9 100644--- a/frontend/src/lib/components/RestrictedArea.tsx+++ b/frontend/src/lib/components/RestrictedArea.tsx@@ -51,9 +51,11 @@ export function useRestrictedArea({}scopeAccessLevel = currentOrganization.membership_level}+if (scopeAccessLevel === null) {return `You don't have access to the current ${scope}.`}+if (scopeAccessLevel < minimumAccessLevel) {if (minimumAccessLevel === OrganizationMembershipLevel.Owner) {return `This area is restricted to the ${scope} owner.`diff --git a/frontend/src/lib/integrations/integrationsLogic.ts b/frontend/src/lib/integrations/integrationsLogic.tsindex 3f784b5c8b64..785a8148ad26 100644--- a/frontend/src/lib/integrations/integrationsLogic.ts+++ b/frontend/src/lib/integrations/integrationsLogic.ts@@ -14,8 +14,11 @@ import { urls } from 'scenes/urls'import { EmailIntegrationDomainGroupedType, IntegrationKind, IntegrationType } from '~/types'-import { integrationsGithubReposRetrieve } from 'products/integrations/frontend/generated/api'-import type { GitHubRepoApi } from 'products/integrations/frontend/generated/api.schemas'+import {+ integrationsGithubReposRetrieve,+ integrationsRequestAccessCreate,+} from 'products/integrations/frontend/generated/api'+import type { GitHubRepoApi, IntegrationKindEnumApi } from 'products/integrations/frontend/generated/api.schemas'import { ChannelType } from 'products/workflows/frontend/Channels/MessageChannels'import type { integrationsLogicType } from './integrationsLogicType'@@ -58,6 +61,7 @@ export const integrationsLogic = kea<integrationsLogicType>([hasMore,}),loadGitHubRepositoriesPageFailure: (integrationId: number) => ({ integrationId }),+ setAccessRequestReason: (reason: string) => ({ reason }),}),reducers({newIntegrationModalKind: [@@ -111,6 +115,20 @@ export const integrationsLogic = kea<integrationsLogicType>([loadGitHubRepositoriesPageFailure: () => false,},],+ requestedAccessKinds: [+ [] as IntegrationKind[],+ {+ requestIntegrationAccessSuccess: (state, { accessRequest }) =>+ accessRequest && !state.includes(accessRequest) ? [...state, accessRequest] : state,+ },+ ],+ accessRequestReason: [+ '',+ {+ setAccessRequestReason: (_, { reason }) => reason,+ requestIntegrationAccessSuccess: () => '',+ },+ ],}),loaders(({ values }) => ({integrations: [@@ -162,6 +180,24 @@ export const integrationsLogic = kea<integrationsLogicType>([},},],+ accessRequest: [+ null as IntegrationKind | null,+ {+ requestIntegrationAccess: async ({ kind }: { kind: IntegrationKind }) => {+ try {+ await integrationsRequestAccessCreate(String(values.currentProjectId), {+ kind: kind as IntegrationKindEnumApi,+ reason: values.accessRequestReason.trim(),+ })+ lemonToast.success('Request sent! Your project admins have been notified.')+ return kind+ } catch (e) {+ toastApiError(e)+ throw e+ }+ },+ },+ ],})),listeners(({ actions, values }) => ({loadGitHubRepositories: ({ integrationId }) => {diff --git a/frontend/src/scenes/integrations/IntegrationFullPage.stories.tsx b/frontend/src/scenes/integrations/IntegrationFullPage.stories.tsxindex 5e68cc9f291e..61599d1097f6 100644--- a/frontend/src/scenes/integrations/IntegrationFullPage.stories.tsx+++ b/frontend/src/scenes/integrations/IntegrationFullPage.stories.tsx@@ -1,5 +1,9 @@+import { MOCK_DEFAULT_ORGANIZATION, MOCK_DEFAULT_TEAM } from 'lib/api.mock'+import { Meta, StoryObj } from '@storybook/react'+import { OrganizationMembershipLevel } from 'lib/constants'+import { mswDecorator } from '~/mocks/browser'import preflightJson from '~/mocks/fixtures/_preflight.json'import { mockIntegration } from '~/test/mocks'@@ -38,3 +42,38 @@ export const NotConnected: Story = {export const Connected: Story = {decorators: [mswDecorator({ get: { '/api/environments/:id/integrations': { results: [mockIntegration] } } })],}++const memberTeam = { ...MOCK_DEFAULT_TEAM, effective_membership_level: OrganizationMembershipLevel.Member }+const memberOrganization = {+ ...MOCK_DEFAULT_ORGANIZATION,+ membership_level: OrganizationMembershipLevel.Member,+ teams: [memberTeam],+}++// Below project-admin level: the connect button is replaced by the "request access" flow.+// `useRestrictedArea` reads the team's `effective_membership_level`, which teamLogic seeds from+// `getAppContext().current_team` (not an API call) — so we lower it in the app context here.+// `beforeEach` runs before Kea mounts teamLogic; the cleanup restores it for other stories.+// organizationLogic still fetches the org, so we mock that to Member too.+export const NoPermission: Story = {+ decorators: [+ mswDecorator({+ get: {+ '/api/environments/:id/integrations': { results: [] },+ '/api/organizations/@current/': memberOrganization,+ },+ }),+ ],+ beforeEach: () => {+ const appContext = window.POSTHOG_APP_CONTEXT+ const originalTeam = appContext?.current_team+ if (appContext) {+ appContext.current_team = memberTeam+ }+ return () => {+ if (appContext) {+ appContext.current_team = originalTeam ?? null+ }+ }+ },+}diff --git a/frontend/src/scenes/integrations/IntegrationFullPage.tsx b/frontend/src/scenes/integrations/IntegrationFullPage.tsxindex bc569850ff6f..7c85b81565d1 100644--- a/frontend/src/scenes/integrations/IntegrationFullPage.tsx+++ b/frontend/src/scenes/integrations/IntegrationFullPage.tsx@@ -1,8 +1,10 @@import { useActions, useValues } from 'kea'import { IconArrowLeft, IconCheckCircle, IconWarning } from '@posthog/icons'-import { LemonButton, Link, Spinner } from '@posthog/lemon-ui'+import { LemonBanner, LemonButton, LemonTextArea, Link, Spinner } from '@posthog/lemon-ui'+import { RestrictionScope, useRestrictedArea } from 'lib/components/RestrictedArea'+import { TeamMembershipLevel } from 'lib/constants'import { integrationsLogic } from 'lib/integrations/integrationsLogic'import { eventUsageLogic } from 'lib/utils/eventUsageLogic'import { urls } from 'scenes/urls'@@ -65,6 +67,11 @@ function ConnectView({SettingsSection: SettingsSectionComponent}): JSX.Element {const { reportIntegrationConnectClicked } = useActions(eventUsageLogic)+ // Connecting an integration requires project admin access (enforced again in the backend).+ const restrictionReason = useRestrictedArea({+ scope: RestrictionScope.Project,+ minimumAccessLevel: TeamMembershipLevel.Admin,+ })const onConnectClick = (): void => {reportIntegrationConnectClicked(definition.slug, definition.kind)@@ -79,10 +86,14 @@ function ConnectView({<div className="text-center text-sm">{definition.description}</div>- {/* onClickCapture fires before the connect button triggers its OAuth redirect */}- <div onClickCapture={onConnectClick}>- <SettingsSection next={urls.integration(definition.slug)} />- </div>+ {restrictionReason ? (+ <RequestAccessSection definition={definition} />+ ) : (+ // onClickCapture fires before the connect button triggers its OAuth redirect+ <div onClickCapture={onConnectClick}>+ <SettingsSection next={urls.integration(definition.slug)} />+ </div>+ )}{definition.docsUrl ? (<Link to={definition.docsUrl} target="_blank" className="text-sm">@@ -93,6 +104,45 @@ function ConnectView({)}+function RequestAccessSection({ definition }: { definition: IntegrationDefinition }): JSX.Element {+ const { accessRequestReason, accessRequestLoading, requestedAccessKinds } = useValues(integrationsLogic)+ const { setAccessRequestReason, requestIntegrationAccess } = useActions(integrationsLogic)++ if (requestedAccessKinds.includes(definition.kind)) {+ return (+ <LemonBanner type="success" className="w-full">+ Request sent. Your project admins have been notified and can connect {definition.name}.+ </LemonBanner>+ )+ }++ return (+ <div className="flex flex-col gap-3 w-full">+ <LemonBanner type="info" className="w-full">+ Connecting {definition.name} requires admin access. Tell your project admins why you need it and we'll+ email them.+ </LemonBanner>+ <LemonTextArea+ value={accessRequestReason}+ onChange={setAccessRequestReason}+ placeholder={`Why does your team need ${definition.name}?`}+ minRows={3}+ maxLength={2000}+ />+ <LemonButton+ type="primary"+ fullWidth+ center+ loading={accessRequestLoading}+ disabledReason={!accessRequestReason.trim() ? 'Add a short note for your admins' : undefined}+ onClick={() => requestIntegrationAccess({ kind: definition.kind })}+ >+ Request {definition.name}+ </LemonButton>+ </div>+ )+}+function ConnectedView({definition,integrations,diff --git a/posthog/api/integration.py b/posthog/api/integration.pyindex 689404b10abf..c684f028daa5 100644--- a/posthog/api/integration.py+++ b/posthog/api/integration.py@@ -14,7 +14,7 @@ import structlogfrom django_filters.rest_framework import DjangoFilterBackendfrom drf_spectacular.utils import extend_schema, extend_schema_serializerfrom rest_framework import mixins, serializers, viewsets-from rest_framework.exceptions import ValidationError+from rest_framework.exceptions import PermissionDenied, ValidationErrorfrom rest_framework.permissions import IsAuthenticatedfrom rest_framework.request import Requestfrom rest_framework.response import Response@@ -31,7 +31,7 @@ from posthog.auth import SessionAuthenticationfrom posthog.domain_connect import discover_domain_connect, extract_root_domain_and_host, get_available_providersfrom posthog.exceptions_capture import capture_exceptionfrom posthog.helpers.fuzzy_search import fuzzy_filter-from posthog.models import User+from posthog.models import OrganizationMembership, Userfrom posthog.models.instance_setting import get_instance_settingfrom posthog.models.integration import (ANTHROPIC_DEFAULT_INTEGRATION_ID_PREFIX,@@ -75,6 +75,7 @@ from posthog.permissions import ()from posthog.rate_limit import GitHubRepositoryRefreshThrottlefrom posthog.rbac.user_access_control import UserAccessControlSerializerMixin+from posthog.tasks.email import send_integration_access_requestfrom products.cdp.backend.services.integration_usage import get_enabled_hog_functions_using_integrationfrom products.workflows.backend.services.integration_usage import get_active_hog_flows_using_integration@@ -301,6 +302,25 @@ class SlackChannelsResponseSerializer(serializers.Serializer):)+class IntegrationAccessRequestSerializer(serializers.Serializer):+ kind = serializers.ChoiceField(+ choices=Integration.IntegrationKind.choices,+ help_text="The kind of integration the member is requesting be connected (e.g. 'slack', 'github').",+ )+ reason = serializers.CharField(+ max_length=2000,+ allow_blank=False,+ trim_whitespace=True,+ help_text="Explanation from the requester of why this integration is needed. Shown to admins in the notification email.",+ )+++class IntegrationAccessRequestResponseSerializer(serializers.Serializer):+ success = serializers.BooleanField(+ help_text="Whether the access request was accepted and the project admins were notified."+ )++@extend_schema_serializer(component_name="IntegrationConfig")class IntegrationSerializer(serializers.ModelSerializer, UserAccessControlSerializerMixin):"""Standard Integration serializer."""@@ -659,6 +679,8 @@ class IntegrationViewSet("refresh_github_repos","github_link_existing","github_oauth_authorize",+ # Side-effecting POST (emails admins) — a read-only token must not be able to trigger it.+ "request_access",]permission_classes = [TeamMemberStrictManagementPermission]queryset = defer_repository_cache_fields(Integration.objects.all())@@ -675,6 +697,14 @@ class IntegrationViewSet(TeamMemberAccessPermission(),TeamMemberLightManagementPermission(),]+ # Any project member may ask an admin to connect an integration — connecting still requires admin.+ if self.action == "request_access":+ return [+ IsAuthenticated(),+ APIScopePermission(),+ AccessControlPermission(),+ TeamMemberAccessPermission(),+ ]raise NotImplementedError()def get_throttles(self):@@ -1198,6 +1228,28 @@ class IntegrationViewSet()return Response({"oauth_url": oauth_url})+ @extend_schema(+ request=IntegrationAccessRequestSerializer,+ responses={200: IntegrationAccessRequestResponseSerializer},+ )+ @action(methods=["POST"], detail=False, url_path="request_access")+ def request_access(self, request: Request, *args: Any, **kwargs: Any) -> Response:+ """Notify project admins that a member is requesting an integration be connected."""+ # Members only — admins can connect integrations themselves, so there's nobody to ask.+ requesting_level = self.user_permissions.current_team.effective_membership_level+ if requesting_level is None or requesting_level >= OrganizationMembership.Level.ADMIN:+ raise PermissionDenied("Only members can request access; admins can connect integrations directly.")++ serializer = IntegrationAccessRequestSerializer(data=request.data)+ serializer.is_valid(raise_exception=True)+ send_integration_access_request.delay(+ team_id=self.team_id,+ requesting_user_id=cast(User, request.user).id,+ kind=serializer.validated_data["kind"],+ reason=serializer.validated_data["reason"],+ )+ return Response({"success": True})+@extend_schema(request=None, responses={200: GitHubReposRefreshResponseSerializer})@action(methods=["POST"], detail=True, url_path="github_repos/refresh")def refresh_github_repos(self, request: Request, *args: Any, **kwargs: Any) -> Response:diff --git a/posthog/api/test/test_integration.py b/posthog/api/test/test_integration.pyindex 5a30bd4c4679..6992d0181449 100644--- a/posthog/api/test/test_integration.py+++ b/posthog/api/test/test_integration.py@@ -7,6 +7,7 @@ from datetime import timedeltafrom urllib.parse import quoteimport pytest+from posthog.test.base import APIBaseTestfrom unittest.mock import MagicMock, patchfrom django.conf import settings as django_settings@@ -3662,3 +3663,60 @@ class TestIntegrationDeletionHogFunctionGuard:assert "Slack flow" in contentassert "Slack notifier" in contentassert Integration.objects.filter(id=self.integration.id).exists()+++class TestIntegrationRequestAccessAPI(APIBaseTest):+ def setUp(self):+ super().setUp()+ # The endpoint is members-only, so default the requester to a plain member.+ self.organization_membership.level = OrganizationMembership.Level.MEMBER+ self.organization_membership.save()++ def _url(self) -> str:+ return f"/api/projects/{self.team.id}/integrations/request_access/"++ @patch("posthog.api.integration.send_integration_access_request")+ def test_member_can_request_access(self, mock_task):+ response = self.client.post(self._url(), {"kind": "slack", "reason": "We need Slack alerts"}, format="json")++ assert response.status_code == status.HTTP_200_OK, response.content+ assert response.json() == {"success": True}+ mock_task.delay.assert_called_once_with(+ team_id=self.team.id,+ requesting_user_id=self.user.id,+ kind="slack",+ reason="We need Slack alerts",+ )++ @parameterized.expand(+ [+ ("admin", OrganizationMembership.Level.ADMIN),+ ("owner", OrganizationMembership.Level.OWNER),+ ]+ )+ @patch("posthog.api.integration.send_integration_access_request")+ def test_admins_cannot_request_access(self, _name, level, mock_task):+ self.organization_membership.level = level+ self.organization_membership.save()++ response = self.client.post(+ self._url(), {"kind": "github", "reason": "Link issues from error tracking"}, format="json"+ )++ assert response.status_code == status.HTTP_403_FORBIDDEN, response.content+ mock_task.delay.assert_not_called()++ @parameterized.expand(+ [+ ("missing_reason", {"kind": "slack"}),+ ("blank_reason", {"kind": "slack", "reason": " "}),+ ("missing_kind", {"reason": "We need it"}),+ ("invalid_kind", {"kind": "not-a-real-kind", "reason": "We need it"}),+ ]+ )+ @patch("posthog.api.integration.send_integration_access_request")+ def test_invalid_payload_is_rejected(self, _name, payload, mock_task):+ response = self.client.post(self._url(), payload, format="json")++ assert response.status_code == status.HTTP_400_BAD_REQUEST, response.content+ mock_task.delay.assert_not_called()diff --git a/posthog/email.py b/posthog/email.pyindex 30a2353d523a..a161e21a9ee9 100644--- a/posthog/email.py+++ b/posthog/email.py@@ -122,6 +122,7 @@ CUSTOMER_IO_TEMPLATE_ID_MAP = {"delegation_invite": "66","provisioning_welcome": "67","baa_signed_ai_disabled": "68",+ "integration_access_requested": "70",}diff --git a/posthog/tasks/email.py b/posthog/tasks/email.pyindex 04a17a541b24..9f1c7485b557 100644--- a/posthog/tasks/email.py+++ b/posthog/tasks/email.py@@ -1980,3 +1980,72 @@ def send_error_tracking_weekly_digest_for_org(org_id: str) -> None:f"Sent Error Tracking weekly digest to {sent_count} members for org {org_id} "f"({len(team_digest_data)} teams with exceptions)")+++def get_integration_display_name(kind: str) -> str:+ # Only kinds whose correct casing differs from the title-cased fallback need an override.+ custom_casing = {"github": "GitHub", "gitlab": "GitLab"}+ return custom_casing.get(kind, kind.replace("-", " ").title())+++@shared_task(**EMAIL_TASK_KWARGS)+@skip_team_scope_audit+def send_integration_access_request(team_id: int, requesting_user_id: int, kind: str, reason: str) -> None:+ """Notify project admins that a member is requesting an integration be connected."""+ team = Team.objects.select_related("organization").filter(id=team_id).first()+ requester = User.objects.filter(id=requesting_user_id).first()+ if team is None or requester is None:+ return++ log_context = {"team_id": team_id, "kind": kind, "requesting_user_id": requesting_user_id}+ requester_name = sanitize_display_name(+ requester.first_name,+ fallback="A teammate",+ context={"task": "send_integration_access_request", "field": "requester_first_name", **log_context},+ )+ org_name = sanitize_display_name(+ team.organization.name,+ fallback="your organization",+ context={"task": "send_integration_access_request", "field": "organization_name", **log_context},+ )+ sanitized_reason = sanitize_message_body(+ reason,+ fallback="",+ context={"task": "send_integration_access_request", "field": "reason", **log_context},+ )+ integration_name = get_integration_display_name(kind)++ # Deterministic per requester + integration so re-clicking doesn't spam admins (MessagingRecord dedups).+ campaign_key = f"integration_access_request_{team_id}_{kind}_{requesting_user_id}"+ subject = f"{requester_name} requested the {integration_name} integration on PostHog"++ # Org admins/owners always have access to every project, so the org-level filter is the access check.+ memberships = (+ OrganizationMembership.objects.select_related("user")+ .filter(organization_id=team.organization_id, level__gte=OrganizationMembership.Level.ADMIN)+ .exclude(user_id=requesting_user_id)+ )+ recipients = [membership.user for membership in memberships if membership.user.email]+ if not recipients:+ return++ message = EmailMessage(+ use_http=True,+ campaign_key=campaign_key,+ subject=subject,+ template_name="integration_access_requested",+ template_context={+ "requester_name": requester_name,+ "requester_email": requester.email or "",+ "integration_name": integration_name,+ "integration_kind": kind,+ "reason": sanitized_reason,+ "org_name": org_name,+ "team_name": team.name,+ "connect_url": f"{settings.SITE_URL}/project/{team_id}/integrations/{kind}",+ },+ reply_to=requester.email or "",+ )+ for user in recipients:+ message.add_user_recipient(user)+ message.send()diff --git a/posthog/tasks/test/__snapshots__/test_task_registration.ambr b/posthog/tasks/test/__snapshots__/test_task_registration.ambrindex f858416ac3a6..dcd43e26d509 100644--- a/posthog/tasks/test/__snapshots__/test_task_registration.ambr+++ b/posthog/tasks/test/__snapshots__/test_task_registration.ambr@@ -37,6 +37,7 @@'posthog.tasks.email.send_hog_function_disabled','posthog.tasks.email.send_hog_functions_daily_digest','posthog.tasks.email.send_hog_functions_digest_email',+ 'posthog.tasks.email.send_integration_access_request','posthog.tasks.email.send_invite','posthog.tasks.email.send_matview_failure_digest','posthog.tasks.email.send_member_join',diff --git a/posthog/templates/email/integration_access_requested.html b/posthog/templates/email/integration_access_requested.htmlnew file mode 100644index 000000000000..b50ce3f264d8--- /dev/null+++ b/posthog/templates/email/integration_access_requested.html@@ -0,0 +1,26 @@+{% extends "email/base.html" %} {% load posthog_assets %} {% load posthog_filters %}+{% block heading %}{{ requester_name }} requested the {{ integration_name }} integration{% endblock %}+{% block section %}+<!-- prettier-ignore -->+<p>+ <strong>{{ requester_name }}</strong> (<a href="mailto:{{ requester_email }}">{{ requester_email }}</a>) wants the+ <strong>{{ integration_name }}</strong> integration connected for <strong>{{ team_name }}</strong>. Connecting+ integrations requires admin access, so they're asking you to set it up.+</p>+{% if reason %}+<div class="invite-message">+ <div class="invite-message-divider"></div>+ <p><strong>Why they need it</strong></p>+ <p>{{ reason }}</p>+</div>+{% endif %}+<div class="mb mt text-center">+ <a class="button primary" href="{{ connect_url }}">Connect {{ integration_name }}</a>+</div>+<div class="mt">+ <p>+ If the button above doesn't work, paste this link into your browser:<br />+ <a href="{{ connect_url }}">{{ connect_url }}</a>+ </p>+</div>+{% endblock %}diff --git a/products/integrations/frontend/generated/api.schemas.ts b/products/integrations/frontend/generated/api.schemas.tsindex dfe714494dcd..84e8ae4d6c4c 100644--- a/products/integrations/frontend/generated/api.schemas.ts+++ b/products/integrations/frontend/generated/api.schemas.ts@@ -336,6 +336,59 @@ export interface GitHubTeamsResponseApi {has_more: boolean}+export interface IntegrationAccessRequestApi {+ /** The kind of integration the member is requesting be connected (e.g. 'slack', 'github').+ *+ * * `anthropic` - Anthropic+ * * `apns` - Apple Push+ * * `azure-blob` - Azure Blob+ * * `bing-ads` - Bing Ads+ * * `clickup` - Clickup+ * * `customerio-app` - Customerio App+ * * `customerio-track` - Customerio Track+ * * `customerio-webhook` - Customerio Webhook+ * * `databricks` - Databricks+ * * `email` - Email+ * * `firebase` - Firebase+ * * `github` - Github+ * * `gitlab` - Gitlab+ * * `google-ads` - Google Ads+ * * `google-analytics` - Google Analytics+ * * `google-cloud-service-account` - Google Cloud Service Account+ * * `google-cloud-storage` - Google Cloud Storage+ * * `google-pubsub` - Google Pubsub+ * * `google-search-console` - Google Search Console+ * * `google-sheets` - Google Sheets+ * * `hubspot` - Hubspot+ * * `intercom` - Intercom+ * * `jira` - Jira+ * * `linear` - Linear+ * * `linkedin-ads` - Linkedin Ads+ * * `meta-ads` - Meta Ads+ * * `pinterest-ads` - Pinterest Ads+ * * `postgresql` - Postgresql+ * * `reddit-ads` - Reddit Ads+ * * `salesforce` - Salesforce+ * * `slack` - Slack+ * * `slack-posthog-code` - Slack Posthog Code+ * * `snapchat` - Snapchat+ * * `stripe` - Stripe+ * * `tiktok-ads` - Tiktok Ads+ * * `twilio` - Twilio+ * * `vercel` - Vercel */+ kind: IntegrationKindEnumApi+ /**+ * Explanation from the requester of why this integration is needed. Shown to admins in the notification email.+ * @maxLength 2000+ */+ reason: string+}++export interface IntegrationAccessRequestResponseApi {+ /** Whether the access request was accepted and the project admins were notified. */+ success: boolean+}+export type RoleExternalReferencesListParams = {/*** Number of results to return per page.diff --git a/products/integrations/frontend/generated/api.ts b/products/integrations/frontend/generated/api.tsindex 87b3a83219ff..67dfab6edab7 100644--- a/products/integrations/frontend/generated/api.ts+++ b/products/integrations/frontend/generated/api.ts@@ -13,6 +13,8 @@ import type {GitHubReposRefreshResponseApi,GitHubReposResponseApi,GitHubTeamsResponseApi,+ IntegrationAccessRequestApi,+ IntegrationAccessRequestResponseApi,IntegrationConfigApi,IntegrationsChannelsRetrieveParams,IntegrationsGithubBranchesRetrieveParams,@@ -700,3 +702,23 @@ export const integrationsGithubOauthAuthorizeCreate = async (body: JSON.stringify(integrationConfigApi),})}++export const getIntegrationsRequestAccessCreateUrl = (projectId: string) => {+ return `/api/projects/${projectId}/integrations/request_access/`+}++/**+ * Notify project admins that a member is requesting an integration be connected.+ */+export const integrationsRequestAccessCreate = async (+ projectId: string,+ integrationAccessRequestApi: IntegrationAccessRequestApi,+ options?: RequestInit+): Promise<IntegrationAccessRequestResponseApi> => {+ return apiMutator<IntegrationAccessRequestResponseApi>(getIntegrationsRequestAccessCreateUrl(projectId), {+ ...options,+ method: 'POST',+ headers: { 'Content-Type': 'application/json', ...options?.headers },+ body: JSON.stringify(integrationAccessRequestApi),+ })+}diff --git a/products/integrations/frontend/generated/api.zod.ts b/products/integrations/frontend/generated/api.zod.tsindex 69849da8e13c..0abbe6bb1a0c 100644--- a/products/integrations/frontend/generated/api.zod.ts+++ b/products/integrations/frontend/generated/api.zod.ts@@ -365,3 +365,63 @@ export const IntegrationsGithubOauthAuthorizeCreateBody = /* @__PURE__ */ zodconfig: zod.unknown().optional(),}).describe('Standard Integration serializer.')++/**+ * Notify project admins that a member is requesting an integration be connected.+ */+export const integrationsRequestAccessCreateBodyReasonMax = 2000++export const IntegrationsRequestAccessCreateBody = /* @__PURE__ */ zod.object({+ kind: zod+ .enum([+ 'anthropic',+ 'apns',+ 'azure-blob',+ 'bing-ads',+ 'clickup',+ 'customerio-app',+ 'customerio-track',+ 'customerio-webhook',+ 'databricks',+ 'email',+ 'firebase',+ 'github',+ 'gitlab',+ 'google-ads',+ 'google-analytics',+ 'google-cloud-service-account',+ 'google-cloud-storage',+ 'google-pubsub',+ 'google-search-console',+ 'google-sheets',+ 'hubspot',+ 'intercom',+ 'jira',+ 'linear',+ 'linkedin-ads',+ 'meta-ads',+ 'pinterest-ads',+ 'postgresql',+ 'reddit-ads',+ 'salesforce',+ 'slack',+ 'slack-posthog-code',+ 'snapchat',+ 'stripe',+ 'tiktok-ads',+ 'twilio',+ 'vercel',+ ])+ .describe(+ '\* `anthropic` - Anthropic\n\* `apns` - Apple Push\n\* `azure-blob` - Azure Blob\n\* `bing-ads` - Bing Ads\n\* `clickup` - Clickup\n\* `customerio-app` - Customerio App\n\* `customerio-track` - Customerio Track\n\* `customerio-webhook` - Customerio Webhook\n\* `databricks` - Databricks\n\* `email` - Email\n\* `firebase` - Firebase\n\* `github` - Github\n\* `gitlab` - Gitlab\n\* `google-ads` - Google Ads\n\* `google-analytics` - Google Analytics\n\* `google-cloud-service-account` - Google Cloud Service Account\n\* `google-cloud-storage` - Google Cloud Storage\n\* `google-pubsub` - Google Pubsub\n\* `google-search-console` - Google Search Console\n\* `google-sheets` - Google Sheets\n\* `hubspot` - Hubspot\n\* `intercom` - Intercom\n\* `jira` - Jira\n\* `linear` - Linear\n\* `linkedin-ads` - Linkedin Ads\n\* `meta-ads` - Meta Ads\n\* `pinterest-ads` - Pinterest Ads\n\* `postgresql` - Postgresql\n\* `reddit-ads` - Reddit Ads\n\* `salesforce` - Salesforce\n\* `slack` - Slack\n\* `slack-posthog-code` - Slack Posthog Code\n\* `snapchat` - Snapchat\n\* `stripe` - Stripe\n\* `tiktok-ads` - Tiktok Ads\n\* `twilio` - Twilio\n\* `vercel` - Vercel'+ )+ .describe(+ "The kind of integration the member is requesting be connected (e.g. 'slack', 'github').\n\n\* `anthropic` - Anthropic\n\* `apns` - Apple Push\n\* `azure-blob` - Azure Blob\n\* `bing-ads` - Bing Ads\n\* `clickup` - Clickup\n\* `customerio-app` - Customerio App\n\* `customerio-track` - Customerio Track\n\* `customerio-webhook` - Customerio Webhook\n\* `databricks` - Databricks\n\* `email` - Email\n\* `firebase` - Firebase\n\* `github` - Github\n\* `gitlab` - Gitlab\n\* `google-ads` - Google Ads\n\* `google-analytics` - Google Analytics\n\* `google-cloud-service-account` - Google Cloud Service Account\n\* `google-cloud-storage` - Google Cloud Storage\n\* `google-pubsub` - Google Pubsub\n\* `google-search-console` - Google Search Console\n\* `google-sheets` - Google Sheets\n\* `hubspot` - Hubspot\n\* `intercom` - Intercom\n\* `jira` - Jira\n\* `linear` - Linear\n\* `linkedin-ads` - Linkedin Ads\n\* `meta-ads` - Meta Ads\n\* `pinterest-ads` - Pinterest Ads\n\* `postgresql` - Postgresql\n\* `reddit-ads` - Reddit Ads\n\* `salesforce` - Salesforce\n\* `slack` - Slack\n\* `slack-posthog-code` - Slack Posthog Code\n\* `snapchat` - Snapchat\n\* `stripe` - Stripe\n\* `tiktok-ads` - Tiktok Ads\n\* `twilio` - Twilio\n\* `vercel` - Vercel"+ ),+ reason: zod+ .string()+ .max(integrationsRequestAccessCreateBodyReasonMax)+ .describe(+ 'Explanation from the requester of why this integration is needed. Shown to admins in the notification email.'+ ),+})diff --git a/products/integrations/mcp/tools.yaml b/products/integrations/mcp/tools.yamlindex d6858c6f8aa3..f0eca9eb91f4 100644--- a/products/integrations/mcp/tools.yaml+++ b/products/integrations/mcp/tools.yaml@@ -159,6 +159,9 @@ tools:- display_name- created_at- created_by+ integrations-request-access-create:+ operation: integrations_request_access_create+ enabled: falseintegrations-twilio-phone-numbers-retrieve:operation: integrations_twilio_phone_numbers_retrieveenabled: falsediff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 0796e370d369..534e321677e0 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -26051,6 +26051,59 @@ export namespace Schemas {Vercel: 'vercel',} as const;+ export interface IntegrationAccessRequest {+ /** The kind of integration the member is requesting be connected (e.g. 'slack', 'github').+ *+ * * `anthropic` - Anthropic+ * * `apns` - Apple Push+ * * `azure-blob` - Azure Blob+ * * `bing-ads` - Bing Ads+ * * `clickup` - Clickup+ * * `customerio-app` - Customerio App+ * * `customerio-track` - Customerio Track+ * * `customerio-webhook` - Customerio Webhook+ * * `databricks` - Databricks+ * * `email` - Email+ * * `firebase` - Firebase+ * * `github` - Github+ * * `gitlab` - Gitlab+ * * `google-ads` - Google Ads+ * * `google-analytics` - Google Analytics+ * * `google-cloud-service-account` - Google Cloud Service Account+ * * `google-cloud-storage` - Google Cloud Storage+ * * `google-pubsub` - Google Pubsub+ * * `google-search-console` - Google Search Console+ * * `google-sheets` - Google Sheets+ * * `hubspot` - Hubspot+ * * `intercom` - Intercom+ * * `jira` - Jira+ * * `linear` - Linear+ * * `linkedin-ads` - Linkedin Ads+ * * `meta-ads` - Meta Ads+ * * `pinterest-ads` - Pinterest Ads+ * * `postgresql` - Postgresql+ * * `reddit-ads` - Reddit Ads+ * * `salesforce` - Salesforce+ * * `slack` - Slack+ * * `slack-posthog-code` - Slack Posthog Code+ * * `snapchat` - Snapchat+ * * `stripe` - Stripe+ * * `tiktok-ads` - Tiktok Ads+ * * `twilio` - Twilio+ * * `vercel` - Vercel */+ kind: IntegrationKindEnum;+ /**+ * Explanation from the requester of why this integration is needed. Shown to admins in the notification email.+ * @maxLength 2000+ */+ reason: string;+ }++ export interface IntegrationAccessRequestResponse {+ /** Whether the access request was accepted and the project admins were notified. */+ success: boolean;+ }+/*** Standard Integration serializer.*/