From 84ae80a451db42795483c40f09e7b8bcf0fc0626 Mon Sep 17 00:00:00 2001 From: George Li Date: Wed, 5 Nov 2025 15:23:04 -0500 Subject: [PATCH 1/4] added a name field to webhook subscriptions --- packages/app/src/cli/models/app/loader.test.ts | 16 ++++++++++++++++ .../webhook_subscription_schema.ts | 1 + .../app_config_webhook_subscription.ts | 2 ++ .../specifications/types/app_config_webhook.ts | 1 + 4 files changed, 20 insertions(+) diff --git a/packages/app/src/cli/models/app/loader.test.ts b/packages/app/src/cli/models/app/loader.test.ts index 273acacc2cb..624a2d02b81 100644 --- a/packages/app/src/cli/models/app/loader.test.ts +++ b/packages/app/src/cli/models/app/loader.test.ts @@ -3441,6 +3441,22 @@ describe('WebhooksSchema', () => { expect(parsedConfiguration.webhooks).toMatchObject(webhookConfig) }) + test('accepts webhook subscription with name', async () => { + const webhookConfig: WebhooksConfig = { + api_version: '2024-01', + subscriptions: [ + { + topics: ['products/create'], + uri: 'https://example.com/webhooks', + name: 'products/create', + }, + ], + } + const {abortOrReport, parsedConfiguration} = await setupParsing({}, webhookConfig) + expect(abortOrReport).not.toHaveBeenCalled() + expect(parsedConfiguration.webhooks).toMatchObject(webhookConfig) + }) + test('accepts webhook subscription with actions', async () => { const webhookConfig: WebhooksConfig = { api_version: '2024-01', diff --git a/packages/app/src/cli/models/extensions/specifications/app_config_webhook_schemas/webhook_subscription_schema.ts b/packages/app/src/cli/models/extensions/specifications/app_config_webhook_schemas/webhook_subscription_schema.ts index 1f33206e5cd..87e240e2c4e 100644 --- a/packages/app/src/cli/models/extensions/specifications/app_config_webhook_schemas/webhook_subscription_schema.ts +++ b/packages/app/src/cli/models/extensions/specifications/app_config_webhook_schemas/webhook_subscription_schema.ts @@ -20,6 +20,7 @@ export const WebhookSubscriptionSchema = zod.object({ include_fields: zod.array(zod.string({invalid_type_error: 'Value must be a string'})).optional(), filter: zod.string({invalid_type_error: 'Value must be a string'}).optional(), payload_query: zod.string({invalid_type_error: 'Value must be a string'}).trim().min(1).optional(), + name: zod.string({invalid_type_error: 'Value must be a string'}).min(1).optional(), compliance_topics: zod .array( diff --git a/packages/app/src/cli/models/extensions/specifications/app_config_webhook_subscription.ts b/packages/app/src/cli/models/extensions/specifications/app_config_webhook_subscription.ts index 0b6034f8da9..00410d73188 100644 --- a/packages/app/src/cli/models/extensions/specifications/app_config_webhook_subscription.ts +++ b/packages/app/src/cli/models/extensions/specifications/app_config_webhook_subscription.ts @@ -16,6 +16,7 @@ interface TransformedWebhookSubscription { include_fields?: string[] filter?: string payload_query?: string + name?: string } export const SingleWebhookSubscriptionSchema = zod.object({ @@ -28,6 +29,7 @@ export const SingleWebhookSubscriptionSchema = zod.object({ include_fields: zod.array(zod.string({invalid_type_error: 'Value must be a string'})).optional(), filter: zod.string({invalid_type_error: 'Value must be a string'}).optional(), payload_query: zod.string({invalid_type_error: 'Value must be a string'}).trim().min(1).optional(), + name: zod.string({invalid_type_error: 'Value must be a string'}).min(1).optional(), }) /* this transforms webhooks remotely to be accepted by the TOML diff --git a/packages/app/src/cli/models/extensions/specifications/types/app_config_webhook.ts b/packages/app/src/cli/models/extensions/specifications/types/app_config_webhook.ts index c9f5f16f6cd..51982bb7a09 100644 --- a/packages/app/src/cli/models/extensions/specifications/types/app_config_webhook.ts +++ b/packages/app/src/cli/models/extensions/specifications/types/app_config_webhook.ts @@ -6,6 +6,7 @@ export interface WebhookSubscription { include_fields?: string[] filter?: string payload_query?: string + name?: string } interface PrivacyComplianceConfig { From 437aedf01eb8e56c6980304f5c8aa2bba796c246 Mon Sep 17 00:00:00 2001 From: George Li Date: Wed, 5 Nov 2025 15:23:04 -0500 Subject: [PATCH 2/4] Added changes to the next release CHANGELOG --- .changeset/spotty-buckets-join.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/spotty-buckets-join.md diff --git a/.changeset/spotty-buckets-join.md b/.changeset/spotty-buckets-join.md new file mode 100644 index 00000000000..1782d860b09 --- /dev/null +++ b/.changeset/spotty-buckets-join.md @@ -0,0 +1,5 @@ +--- +'@shopify/app': minor +--- + +Add support for an optional name field for webhook subscriptions in shopify.app.toml From e39dbb6cf08bd72d329271b721d6151448010baa Mon Sep 17 00:00:00 2001 From: George Li Date: Wed, 5 Nov 2025 16:39:44 -0500 Subject: [PATCH 3/4] added max char validation --- .../app_config_webhook_schemas/webhook_subscription_schema.ts | 2 +- .../specifications/app_config_webhook_subscription.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/app/src/cli/models/extensions/specifications/app_config_webhook_schemas/webhook_subscription_schema.ts b/packages/app/src/cli/models/extensions/specifications/app_config_webhook_schemas/webhook_subscription_schema.ts index 87e240e2c4e..d91967f6b65 100644 --- a/packages/app/src/cli/models/extensions/specifications/app_config_webhook_schemas/webhook_subscription_schema.ts +++ b/packages/app/src/cli/models/extensions/specifications/app_config_webhook_schemas/webhook_subscription_schema.ts @@ -20,7 +20,7 @@ export const WebhookSubscriptionSchema = zod.object({ include_fields: zod.array(zod.string({invalid_type_error: 'Value must be a string'})).optional(), filter: zod.string({invalid_type_error: 'Value must be a string'}).optional(), payload_query: zod.string({invalid_type_error: 'Value must be a string'}).trim().min(1).optional(), - name: zod.string({invalid_type_error: 'Value must be a string'}).min(1).optional(), + name: zod.string({invalid_type_error: 'Value must be a string'}).min(1).max(50).optional(), compliance_topics: zod .array( diff --git a/packages/app/src/cli/models/extensions/specifications/app_config_webhook_subscription.ts b/packages/app/src/cli/models/extensions/specifications/app_config_webhook_subscription.ts index 00410d73188..c1cffad42b7 100644 --- a/packages/app/src/cli/models/extensions/specifications/app_config_webhook_subscription.ts +++ b/packages/app/src/cli/models/extensions/specifications/app_config_webhook_subscription.ts @@ -29,7 +29,7 @@ export const SingleWebhookSubscriptionSchema = zod.object({ include_fields: zod.array(zod.string({invalid_type_error: 'Value must be a string'})).optional(), filter: zod.string({invalid_type_error: 'Value must be a string'}).optional(), payload_query: zod.string({invalid_type_error: 'Value must be a string'}).trim().min(1).optional(), - name: zod.string({invalid_type_error: 'Value must be a string'}).min(1).optional(), + name: zod.string({invalid_type_error: 'Value must be a string'}).min(1).max(50).optional(), }) /* this transforms webhooks remotely to be accepted by the TOML From 833d75115f6410aefa89d95372335201291436bc Mon Sep 17 00:00:00 2001 From: George Li Date: Thu, 6 Nov 2025 09:29:21 -0500 Subject: [PATCH 4/4] added trim() to name field --- .../app_config_webhook_schemas/webhook_subscription_schema.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/app/src/cli/models/extensions/specifications/app_config_webhook_schemas/webhook_subscription_schema.ts b/packages/app/src/cli/models/extensions/specifications/app_config_webhook_schemas/webhook_subscription_schema.ts index d91967f6b65..7c22dd007d2 100644 --- a/packages/app/src/cli/models/extensions/specifications/app_config_webhook_schemas/webhook_subscription_schema.ts +++ b/packages/app/src/cli/models/extensions/specifications/app_config_webhook_schemas/webhook_subscription_schema.ts @@ -20,7 +20,7 @@ export const WebhookSubscriptionSchema = zod.object({ include_fields: zod.array(zod.string({invalid_type_error: 'Value must be a string'})).optional(), filter: zod.string({invalid_type_error: 'Value must be a string'}).optional(), payload_query: zod.string({invalid_type_error: 'Value must be a string'}).trim().min(1).optional(), - name: zod.string({invalid_type_error: 'Value must be a string'}).min(1).max(50).optional(), + name: zod.string({invalid_type_error: 'Value must be a string'}).trim().min(1).max(50).optional(), compliance_topics: zod .array(