Gate connected-account webhook subscriptions behind config (#22761)

Now gated behind IS_CONNECTED_ACCOUNT_WEBHOOK_SUBSCRIPTION_ENABLED
(default false).

Merge + deploy twentyhq/twenty-infra#780 first.

<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/twentyhq/twenty/pull/22761?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->

Co-authored-by: Charles Bochet <charlesBochet@users.noreply.github.com>
This commit is contained in:
neo773
2026-07-10 15:03:53 +05:30
committed by GitHub
parent a360f9bdec
commit f547da4ee9
2 changed files with 28 additions and 0 deletions
@@ -209,6 +209,16 @@ export class ConfigVariables {
@IsOptional()
MESSAGING_GMAIL_PUBSUB_VERIFICATION_EMAIL: string;
@ConfigVariablesMetadata({
group: ConfigVariablesGroup.ADVANCED_SETTINGS,
description:
'Enable webhook-based sync for connected accounts (provider push ' +
'notifications on top of polling). Requires publicly reachable ' +
'webhook endpoints.',
type: ConfigVariableType.BOOLEAN,
})
IS_CONNECTED_ACCOUNT_WEBHOOK_SUBSCRIPTION_ENABLED = false;
@ConfigVariablesMetadata({
group: ConfigVariablesGroup.ADVANCED_SETTINGS,
description: 'Enable or disable the IMAP messaging integration',
@@ -13,6 +13,7 @@ import { Not, Repository } from 'typeorm';
import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator';
import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants';
import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service';
import { TwentyConfigService } from 'src/engine/core-modules/twenty-config/twenty-config.service';
import { CalendarChannelEntity } from 'src/engine/metadata-modules/calendar-channel/entities/calendar-channel.entity';
import { MessageChannelEntity } from 'src/engine/metadata-modules/message-channel/entities/message-channel.entity';
import { GlobalWorkspaceOrmManager } from 'src/engine/twenty-orm/global-workspace-datasource/global-workspace-orm.manager';
@@ -53,6 +54,7 @@ export class ChannelSyncService {
private readonly messageChannelSyncStatusService: MessageChannelSyncStatusService,
@InjectRepository(CalendarChannelEntity)
private readonly calendarChannelRepository: Repository<CalendarChannelEntity>,
private readonly twentyConfigService: TwentyConfigService,
) {}
async startChannelSync(input: StartChannelSyncInput): Promise<void> {
@@ -92,6 +94,14 @@ export class ChannelSyncService {
},
);
if (
!this.twentyConfigService.get(
'IS_CONNECTED_ACCOUNT_WEBHOOK_SUBSCRIPTION_ENABLED',
)
) {
continue;
}
try {
await this.webhookQueueService.add<CreateWebhookSubscriptionJobData>(
CreateWebhookSubscriptionJob.name,
@@ -144,6 +154,14 @@ export class ChannelSyncService {
},
);
if (
!this.twentyConfigService.get(
'IS_CONNECTED_ACCOUNT_WEBHOOK_SUBSCRIPTION_ENABLED',
)
) {
continue;
}
try {
await this.webhookQueueService.add<CreateWebhookSubscriptionJobData>(
CreateWebhookSubscriptionJob.name,