From 3e31b3a42f837967d58f8475d0492601b05bac49 Mon Sep 17 00:00:00 2001 From: Lukasz Ostrowski Date: Wed, 6 Sep 2023 09:30:56 +0200 Subject: [PATCH] Mark query in manifest required (#280) * Mark query in manifest required * Update tender-news-do.md --- .changeset/tender-news-do.md | 11 +++++++++++ src/types.ts | 13 +++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 .changeset/tender-news-do.md diff --git a/.changeset/tender-news-do.md b/.changeset/tender-news-do.md new file mode 100644 index 0000000..fe4960a --- /dev/null +++ b/.changeset/tender-news-do.md @@ -0,0 +1,11 @@ +--- +"@saleor/app-sdk": patch +--- + +Changed the "query" field in the AppManifest webhook to be required. Previously, this field was optional. + +For subscription events, Saleor rejects webhooks without query, so this field was valid only with legacy non-subscription webhooks. + +Now, the query is obligatory. + +Warning: This can be a breaking change for some scenarios where legacy webhooks were used! diff --git a/src/types.ts b/src/types.ts index f38fbcc..927d108 100644 --- a/src/types.ts +++ b/src/types.ts @@ -213,8 +213,17 @@ export interface WebhookManifest { name: string; asyncEvents?: AsyncWebhookEventType[]; syncEvents?: SyncWebhookEventType[]; - /** If query is not provided, the default webhook payload will be used */ - query?: string; + /** + * Query is required for a subscription. + * If you don't need a payload, you can provide empty query like this: + * + * subscription { + * event { + * __typename + * } + * } + */ + query: string; /** The full URL of the endpoint where request will be sent */ targetUrl: string; isActive?: boolean;