@notionhq/apps 0.0.34 → 0.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"codegen.d.ts","sourceRoot":"","sources":["../../src/cli/codegen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1D;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,YAAY,EAAE,SAAS,oBAAoB,EAAE,GAAG,MAAM,CA6CnF;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,SAAS,oBAAoB,EAAE,GAAG,MAAM,CAuB3F;AAED,mFAAmF;AACnF,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,SAAS,oBAAoB,EAAE,GAAG,MAAM,CAWzF"}
1
+ {"version":3,"file":"codegen.d.ts","sourceRoot":"","sources":["../../src/cli/codegen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1D;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,YAAY,EAAE,SAAS,oBAAoB,EAAE,GAAG,MAAM,CAqDnF;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,SAAS,oBAAoB,EAAE,GAAG,MAAM,CAuB3F;AAED,mFAAmF;AACnF,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,SAAS,oBAAoB,EAAE,GAAG,MAAM,CAWzF"}
@@ -22,16 +22,24 @@ export const capabilities: Record<string, Record<string, { handler: Handler }>>
22
22
  ${registry}
23
23
  };
24
24
 
25
+ // The platform dispatches a workflow's synchronous webhook verify run under its
26
+ // own invocation type. It resolves to the same capability, which tells a verify
27
+ // invocation from a trigger event by the shape of its input.
28
+ const invocationTypes: Record<string, string | undefined> = {
29
+ workflowWebhookVerify: "workflow",
30
+ };
31
+
25
32
  export async function run(
26
33
  type: string,
27
34
  key: string,
28
35
  context?: unknown,
29
36
  options?: { concreteOutput?: true },
30
37
  ): Promise<unknown> {
31
- const capability = capabilities[type]?.[key];
38
+ const capabilityType = invocationTypes[type] ?? type;
39
+ const capability = capabilities[capabilityType]?.[key];
32
40
 
33
41
  if (!capability) {
34
- throw new Error(\`Capability "\${type}/\${key}" not found\`);
42
+ throw new Error(\`Capability "\${capabilityType}/\${key}" not found\`);
35
43
  }
36
44
 
37
45
  return capability.handler(context, options);
@@ -16,6 +16,8 @@ export type PropertyTriggerCondition = {
16
16
  export type CustomAgentPageAddedTrigger = CustomAgentTriggerBase & {
17
17
  type: "page_added";
18
18
  dataSourceResourceId: ResourceId;
19
+ /** Wait for follow-up edits before running the agent. Defaults to false in Apps. */
20
+ waitForEditsToFinish?: boolean;
19
21
  };
20
22
  type PropertyUpdatedTriggerTarget = {
21
23
  propertyConditions: Readonly<Record<ResourceId, PropertyTriggerCondition>>;
@@ -27,6 +29,8 @@ type PropertyUpdatedTriggerTarget = {
27
29
  export type CustomAgentPropertyUpdatedTrigger = CustomAgentTriggerBase & PropertyUpdatedTriggerTarget & {
28
30
  type: "property_updated";
29
31
  dataSourceResourceId: ResourceId;
32
+ /** Wait for follow-up edits before running the agent. Defaults to false in Apps. */
33
+ waitForEditsToFinish?: boolean;
30
34
  };
31
35
  export type CustomAgentTrigger = CustomAgentRecurrenceTrigger | CustomAgentPageAddedTrigger | CustomAgentPropertyUpdatedTrigger;
32
36
  /**
@@ -41,15 +45,8 @@ export type CustomAgentAccess = Extract<WorkflowAccessDeclaration, {
41
45
  readonly resourceType: "page" | "database";
42
46
  };
43
47
  }>;
44
- /**
45
- * URL trust settings for a custom agent.
46
- *
47
- * URL trust is independent from web access: an agent can trust URLs without
48
- * being granted web search access.
49
- */
50
- export type CustomAgentTrustedUrls = {
51
- type: "all";
52
- };
48
+ /** Trust every URL, trust no URLs, or trust a nonempty list of up to 20 URL globs. */
49
+ export type CustomAgentTrustedUrls = "all" | "none" | [string, ...string[]];
53
50
  export type CustomAgentArgs = {
54
51
  resourceId: ResourceId;
55
52
  name: string;
@@ -58,6 +55,8 @@ export type CustomAgentArgs = {
58
55
  }>;
59
56
  instructions?: string;
60
57
  model?: "ambrosia-tart-high" | "opal-quince-medium" | "almond-croissant-low";
58
+ /** Whether the agent can use the Web Browser. Omission preserves the existing setting. */
59
+ browserUse?: boolean;
61
60
  /**
62
61
  * Whether the agent can use web search. Defaults to `false` when omitted for
63
62
  * a new agent. When updating an existing agent, omitting this field preserves
@@ -65,9 +64,10 @@ export type CustomAgentArgs = {
65
64
  */
66
65
  webAccess?: boolean;
67
66
  /**
68
- * URL trust policy for this agent. `{ type: "all" }` allows every HTTP and
69
- * HTTPS URL. For a new agent, omitting this field leaves URL trust disabled;
70
- * for an existing agent, omission preserves the current URL trust policy.
67
+ * Set `"all"` to trust every HTTP and HTTPS URL, `"none"` to disable URL
68
+ * trust, or provide a nonempty list of up to 20 URL globs. Omission leaves
69
+ * trust disabled for a new agent and preserves it for an existing agent.
70
+ * URL trust is independent from web search.
71
71
  */
72
72
  trustedUrls?: CustomAgentTrustedUrls;
73
73
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"custom-agent.d.ts","sourceRoot":"","sources":["../../src/notion-as-code/custom-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,KAAK,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACnG,OAAO,KAAK,EAAqB,gBAAgB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAIpF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,YAAY,EACX,kBAAkB,EAClB,wBAAwB,EACxB,4BAA4B,EAC5B,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,kBAAkB,GAClB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,MAAM,6BAA6B,GAAG,kBAAkB,GAAG;IAAE,IAAI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GAAG,MAAM,EAAE,CAAC,CAAC;AAE5E,MAAM,MAAM,eAAe,GAAG;IAC7B,UAAU,EAAE,UAAU,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC,gBAAgB,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,oBAAoB,GAAG,oBAAoB,GAAG,sBAAsB,CAAC;IAC7E,0FAA0F;IAC1F,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,sBAAsB,CAAC;IACrC;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACtC,QAAQ,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC/B,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,oEAAoE;AACpE,wBAAgB,WAAW,CAAC,IAAI,EAAE,eAAe,GAAG,iBAAiB,CAgCpE"}
@@ -22,14 +22,28 @@ function customAgent(args) {
22
22
  }
23
23
  }
24
24
  }
25
- const { access: _access, ...intent } = args;
25
+ const { access: _access, trustedUrls, triggers, ...intent } = args;
26
26
  recordIntent({
27
27
  type: "custom_agent",
28
28
  ...intent,
29
+ ...trustedUrls === void 0 ? {} : { trustedUrls: toTrustedUrlsIntent(trustedUrls) },
30
+ ...triggers === void 0 ? {} : { triggers: triggers.map(toTriggerIntent) },
29
31
  ...grants === void 0 ? {} : { access: grants }
30
32
  });
31
33
  return { resourceType: "customAgent", resourceId: args.resourceId };
32
34
  }
35
+ function toTriggerIntent(trigger) {
36
+ if (trigger.type === "recurrence") {
37
+ return trigger;
38
+ }
39
+ return { ...trigger, waitForEditsToFinish: trigger.waitForEditsToFinish ?? false };
40
+ }
41
+ function toTrustedUrlsIntent(trustedUrls) {
42
+ if (trustedUrls === "all") {
43
+ return { type: "all" };
44
+ }
45
+ return { type: "list", urls: trustedUrls === "none" ? [] : [...trustedUrls] };
46
+ }
33
47
  export {
34
48
  customAgent
35
49
  };
@@ -255,7 +255,13 @@ export type DatabaseIntent = {
255
255
  export type PageIntent = PageArgs & {
256
256
  parent: Parent;
257
257
  };
258
- export type CustomAgentIntent = Omit<CustomAgentArgs, "access"> & {
258
+ export type CustomAgentIntent = Omit<CustomAgentArgs, "access" | "trustedUrls"> & {
259
+ trustedUrls?: {
260
+ type: "all";
261
+ } | {
262
+ type: "list";
263
+ urls: string[];
264
+ };
259
265
  access?: readonly {
260
266
  resourceId: ResourceId;
261
267
  level: ResourceAccessLevel;
@@ -1 +1 @@
1
- {"version":3,"file":"intents.d.ts","sourceRoot":"","sources":["../../src/notion-as-code/intents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,+EAA+E;AAC/E,6EAA6E;AAC7E,eAAO,MAAM,0BAA0B,8BAA8B,CAAC;AACtE,kEAAkE;AAClE,eAAO,MAAM,gCAAgC,mBAAmB,CAAC;AAEjE,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC,MAAM,MAAM,MAAM,GAAG;IACpB,IAAI,EAAE,YAAY,CAAC;IACnB,UAAU,EAAE,UAAU,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,gBAA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E,CAAC;IACjE,MAAM,CAAC,EAAE,SAAS;QAAE,UAAU,EAAE,UAAU,CAAC;QAAC,KAAK,EAAE,mBAAmB,CAAA;KAAE,EAAE,CAAC;CAC3E,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACxB,kBAAkB,EAAE,UAAU,CAAC;IAC/B,IAAI,EAAE,UAAU,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAC1B,CAAC;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GAAG,eAAe,CAAC,GACzC,CAAC;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GAAG,cAAc,CAAC,GACvC,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,CAAC,GAC/B,CAAC;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,GAAG,iBAAiB,CAAC,GAC9C,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,CAAC,CAAC"}
@@ -3,7 +3,7 @@ import { type WorkflowAccess, type WorkflowAccessDeclarations, type WorkflowAcce
3
3
  import type { CapabilityContext } from "./context.js";
4
4
  import { type RunMetadata } from "./runtime-metadata.js";
5
5
  import { type WorkflowState } from "./workflow-state.js";
6
- import type { WorkflowEventMap, WorkflowTrigger, WorkflowEventCreators, WorkflowTriggerForConnections } from "./events.generated.js";
6
+ import type { WebhookTrigger, WorkflowEventMap, WorkflowTrigger, WorkflowEventCreators, WorkflowTriggerForConnections } from "./events.generated.js";
7
7
  type HandlerOptions = {
8
8
  /** Return the concrete result instead of writing the output envelope. */
9
9
  concreteOutput?: true;
@@ -98,6 +98,67 @@ export type WorkflowEvent = WorkflowEventMap[keyof WorkflowEventMap];
98
98
  export type WorkflowEventForTrigger<T extends WorkflowTrigger> = WorkflowEventMap[T["type"]];
99
99
  export type WorkflowEventForTriggers<T extends readonly WorkflowTrigger[]> = WorkflowEventForTrigger<T[number]>;
100
100
  export { connections, type WorkflowConnection, type WorkflowConnectionDeclarations, type WorkflowConnectionRequirement, type WorkflowConnections, type OAuthConfiguration, type OAuthConnection, } from "./connections.js";
101
+ /**
102
+ * The inbound HTTP request passed to a webhook verify handler.
103
+ */
104
+ export type WebhookVerifyRequest = {
105
+ /** Uppercase HTTP method. Deliveries are POSTs; GET/HEAD cover challenge probes. */
106
+ method: "GET" | "HEAD" | "POST";
107
+ /** The full webhook URL as received. */
108
+ url: string;
109
+ /** Query string parameters. */
110
+ query: Record<string, string>;
111
+ /** Request headers with lowercased names. */
112
+ headers: Record<string, string>;
113
+ /** Raw request body. Empty string for bodyless methods like GET and HEAD. */
114
+ rawBody: string;
115
+ };
116
+ /**
117
+ * The HTTP response a verify handler produces. `deliver`, when present,
118
+ * explicitly controls whether the request is enqueued for the workflow
119
+ * handler. Otherwise delivery is derived from the status: 2xx enqueues and 4xx
120
+ * does not.
121
+ */
122
+ export type WebhookVerifyResponse = {
123
+ /** Response status code. Only 2xx and 4xx statuses are allowed. */
124
+ status: number;
125
+ /** Optional response body, at most 8KB. */
126
+ body?: string;
127
+ /** Response content type. Defaults to "text/plain". */
128
+ contentType?: "application/json" | "text/plain";
129
+ /**
130
+ * Whether to enqueue the request for the workflow handler. Defaults to true
131
+ * for 2xx responses and false for 4xx responses.
132
+ */
133
+ deliver?: boolean;
134
+ };
135
+ /**
136
+ * A webhook verify handler. Runs synchronously at Notion's webhook ingress,
137
+ * before the HTTP response is sent, in the app's own sandbox — the same
138
+ * runtime as the workflow handler, with the full Node.js standard library.
139
+ * Read signing secrets from `process.env` and use `node:crypto` for
140
+ * signature checks.
141
+ *
142
+ * Keep it fast: the run must fit a small wall-clock budget (a few seconds,
143
+ * including sandbox startup), so avoid network calls — including
144
+ * `context.notion` API calls, which typically won't fit the budget.
145
+ */
146
+ export type WebhookVerifyHandler = (request: WebhookVerifyRequest, context: CapabilityContext) => WebhookVerifyResponse | Promise<WebhookVerifyResponse>;
147
+ /**
148
+ * A verify invocation as dispatched by the platform: a single `request`
149
+ * object rather than the event a workflow invocation carries.
150
+ */
151
+ export type WebhookVerifyInvocation = {
152
+ request: WebhookVerifyRequest;
153
+ };
154
+ /**
155
+ * A trigger as the manifest records it. A declared `verify` handler is flagged
156
+ * on the webhook trigger itself, which is where the platform reads it to decide
157
+ * whether to run `verify` at webhook ingress.
158
+ */
159
+ export type WorkflowManifestTrigger = WorkflowTrigger | (WebhookTrigger & {
160
+ hasVerify: true;
161
+ });
101
162
  /**
102
163
  * Configuration passed to {@link workflow}.
103
164
  */
@@ -126,6 +187,39 @@ export type WorkflowConfiguration<TTriggers extends readonly [WorkflowTrigger, .
126
187
  * Connections that must be set up before this workflow can run.
127
188
  */
128
189
  connections?: TConnections;
190
+ /**
191
+ * Optional synchronous verification handler, run at Notion's webhook
192
+ * ingress before the HTTP response is sent. Use it for providers that
193
+ * require a synchronous verification response: signature checks with
194
+ * specific status codes, challenge echoes, or handshake requests.
195
+ *
196
+ * Only workflows with an `events.webhook()` trigger may declare one.
197
+ *
198
+ * The handler controls the HTTP response. Return `deliver: true` to enqueue
199
+ * the request for the workflow handler, or `deliver: false` to answer the
200
+ * provider without enqueueing it. When omitted, 2xx enqueues and 4xx does
201
+ * not. `verify` runs in the app's own sandbox with full Node.js — read
202
+ * secrets from `process.env` and use `node:crypto` for signature checks. It
203
+ * receives the capability context as its second argument, without the run
204
+ * metadata and `step` a workflow run carries.
205
+ *
206
+ * Without `verify`, the webhook keeps the current behavior: every request
207
+ * is accepted with `202` and processed asynchronously.
208
+ *
209
+ * @example
210
+ * ```ts
211
+ * verify: (request) => {
212
+ * const signature = createHmac("sha256", process.env.WEBHOOK_SECRET ?? "")
213
+ * .update(request.rawBody)
214
+ * .digest("hex");
215
+ * const expected = Buffer.from(`sha256=${signature}`);
216
+ * const actual = Buffer.from(request.headers["x-hub-signature-256"] ?? "");
217
+ * const verified = expected.length === actual.length && timingSafeEqual(expected, actual);
218
+ * return verified ? { status: 200 } : { status: 401, body: "Invalid signature" };
219
+ * },
220
+ * ```
221
+ */
222
+ verify?: WebhookVerifyHandler;
129
223
  handler: (event: WorkflowEventForTriggers<TTriggers>, context: WorkflowContext<TConnections, TAccess>) => Promise<void> | void;
130
224
  };
131
225
  /** Configuration that checks trigger keys against declared connections. */
@@ -148,11 +242,11 @@ export type Workflow<TTriggers extends readonly [WorkflowTrigger, ...WorkflowTri
148
242
  config: {
149
243
  name: string;
150
244
  description: string;
151
- triggers: TTriggers;
245
+ triggers: WorkflowManifestTrigger[];
152
246
  connections?: readonly WorkflowConnectionRequirement[];
153
247
  access?: WorkflowAccessRequirements;
154
248
  };
155
- handler: (event: WorkflowEventForTriggers<TTriggers>, options?: HandlerOptions) => Promise<WorkflowHandlerResult | undefined>;
249
+ handler: (input: WorkflowEventForTriggers<TTriggers> | WebhookVerifyInvocation, options?: HandlerOptions) => Promise<WorkflowHandlerResult | WebhookVerifyResponse | undefined>;
156
250
  };
157
251
  /**
158
252
  * Create a workflow capability.
@@ -1 +1 @@
1
- {"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../src/workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,KAAK,8BAA8B,EACnC,KAAK,6BAA6B,EAClC,KAAK,mBAAmB,EACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAGN,KAAK,cAAc,EACnB,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAC/B,MAAM,sBAAsB,CAAC;AAK9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAKtD,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE1E,OAAO,EAA2B,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,KAAK,EACX,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,6BAA6B,EAC7B,MAAM,uBAAuB,CAAC;AAE/B,KAAK,cAAc,GAAG;IACrB,yEAAyE;IACzE,cAAc,CAAC,EAAE,IAAI,CAAC;CACtB,CAAC;AAEF,KAAK,0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AO,EAAE,2BAA2B,CAAC,OAAO,CAAC,GAC3C,OAAO,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC,CAAC;CAC3C,CAAC;AAEF,4CAA4C;AAC5C,MAAM,MAAM,eAAe,CAC1B,YAAY,SAAS,8BAA8B,GAAG,8BAA8B,EACpF,OAAO,SAAS,0BAA0B,GAAG,0BAA0B,IACpE,iBAAiB,GAAG;IACvB,0FAA0F;IAC1F,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IACzC,WAAW,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;CAC/C,GAAG,WAAW,GAAG;IAChB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,IAAI,EAAE,YAAY,CAAC;IACnB,iEAAiE;IACjE,IAAI,EAAE,YAAY,CAAC;CACnB,CAAC"}
package/dist/workflow.js CHANGED
@@ -17,6 +17,7 @@ import { resolveRuntimeInput } from "./runtime-input.js";
17
17
  import { readRunMetadata } from "./runtime-metadata.js";
18
18
  import { createWorkflowEvents } from "./events.generated.js";
19
19
  import { createWorkflowStepState } from "./workflow-state.js";
20
+ const WEBHOOK_TRIGGER_TYPE = "webhooks.webhook";
20
21
  const input = {
21
22
  text(options) {
22
23
  return { type: "text", ...options };
@@ -56,18 +57,40 @@ function workflow(configuration) {
56
57
  const connectionDeclarations = configuration.connections === void 0 ? void 0 : structuredClone(configuration.connections);
57
58
  const triggers = typeof configuration.triggers === "function" ? configuration.triggers({ events: createWorkflowEvents() }) : configuration.triggers;
58
59
  validateTriggerConnections(triggers, requirements);
60
+ if (configuration.verify !== void 0 && !triggers.some((trigger) => trigger.type === WEBHOOK_TRIGGER_TYPE)) {
61
+ throw new Error(
62
+ `Workflow "${configuration.name}" declares a verify handler but has no webhook trigger. Add events.webhook() or remove verify.`
63
+ );
64
+ }
59
65
  return {
60
66
  _tag: "workflow",
61
67
  config: {
62
68
  name: configuration.name,
63
69
  description: configuration.description,
64
- triggers,
70
+ triggers: manifestTriggers(triggers, configuration.verify !== void 0),
65
71
  ...configuration.connections === void 0 ? {} : { connections: requirements },
66
72
  ...configuration.access === void 0 ? {} : { access: accessRequirements }
67
73
  },
68
- async handler(event, options) {
74
+ async handler(input2, options) {
69
75
  try {
70
- event = await resolveRuntimeInput(event);
76
+ input2 = await resolveRuntimeInput(input2);
77
+ if (isVerifyInvocation(input2)) {
78
+ if (configuration.verify === void 0) {
79
+ throw new Error(
80
+ `Workflow "${configuration.name}" received a verify request but does not declare a verify handler`
81
+ );
82
+ }
83
+ const response = await configuration.verify(
84
+ input2.request,
85
+ createCapabilityContext()
86
+ );
87
+ if (options?.concreteOutput) {
88
+ return response;
89
+ }
90
+ writeOutput({ _tag: "success", value: response });
91
+ return void 0;
92
+ }
93
+ const event = input2;
71
94
  const runMetadata = readRunMetadata();
72
95
  const baseContext = createCapabilityContext();
73
96
  const step = createStep(runMetadata);
@@ -114,6 +137,14 @@ function workflow(configuration) {
114
137
  }
115
138
  };
116
139
  }
140
+ function manifestTriggers(triggers, hasVerify) {
141
+ return triggers.map(
142
+ (trigger) => hasVerify && trigger.type === WEBHOOK_TRIGGER_TYPE ? { ...trigger, hasVerify: true } : trigger
143
+ );
144
+ }
145
+ function isVerifyInvocation(input2) {
146
+ return typeof input2 === "object" && input2 !== null && "request" in input2;
147
+ }
117
148
  const WORKFLOW_STEP_DIRECTORY_ENV_KEY = "NOTION_WORKFLOW_STEP_DIRECTORY";
118
149
  const MAX_WORKFLOW_STEP_KEY_LENGTH = 43;
119
150
  const WORKFLOW_STEP_KEY_PATTERN = /^[A-Za-z0-9_-]+$/;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@notionhq/apps",
3
- "version": "0.0.34",
3
+ "version": "0.0.36",
4
4
  "description": "An SDK for building workflow apps for Notion",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -191,15 +191,17 @@ Do not add every optional field by default. Decide on each field separately:
191
191
  `access.fullAccess(handle)` only when broader access is required. Pass a page
192
192
  or database handle, not a resource ID or data-source handle. Custom-agent
193
193
  declarations do not accept `access.call(agent)`.
194
+ - `browserUse`: set `true` only when the agent needs the Web Browser. Set
195
+ `false` to explicitly disable it; omission preserves the existing setting.
194
196
  - `webAccess`: set `true` only when the agent must search the web. Set `false`
195
197
  when the declaration must explicitly disable web search. For a new agent,
196
198
  omission defaults to `false`; for an existing agent, omission preserves its
197
199
  current web access and domain restrictions.
198
- - `trustedUrls`: set `{ type: "all" }` only when the agent must trust every HTTP
199
- and HTTPS URL. URL trust is independent of web search, so do not add it merely
200
- because `webAccess` is enabled. Omission disables URL trust for a new agent
201
- and preserves the current policy for an existing agent. The current type has
202
- no value that clears an existing trust policy.
200
+ - `trustedUrls`: set `"all"` only when the agent must trust every HTTP and
201
+ HTTPS URL, `"none"` to disable trust, or a nonempty array of up to 20 URL
202
+ globs to trust specific URLs. URL trust is independent of web search, so do
203
+ not add it merely because `webAccess` is enabled. Omission disables URL trust
204
+ for a new agent and preserves the current policy for an existing agent.
203
205
  - `triggers`: set only when the agent should run automatically. Use
204
206
  `recurrence` for a schedule, `page_added` for new rows in a data source, and
205
207
  `property_updated` for selected property edits and/or page-content edits.
@@ -227,8 +229,10 @@ For a recurrence trigger, always set `interval`, `start`, and `timeZone`; add
227
229
  `weekdays` object, and monthly triggers require `monthlyRestriction`. Page-added
228
230
  and property-updated triggers reference a declared data source by
229
231
  `dataSourceResourceId`. Property-updated triggers require property conditions
230
- or `triggerWhenPageContentEdited: true`. Give every trigger its own stable
231
- `resourceId`.
232
+ or `triggerWhenPageContentEdited: true`. For either data-source trigger,
233
+ Apps defaults `waitForEditsToFinish` to `false`, so the agent runs without
234
+ waiting for follow-up edits. Set it to `true` when the agent should wait.
235
+ Give every trigger its own stable `resourceId`.
232
236
 
233
237
  Database page layouts are typed against their keyed data-source schema. Reference
234
238
  property resource IDs, not schema keys. The SDK restricts relation groups to
@@ -544,6 +544,24 @@ describe("buildApp", () => {
544
544
  expect(JSON.parse(await fs.promises.readFile(manifestPath, "utf8"))).toEqual(manifest);
545
545
  });
546
546
 
547
+ it("records a workflow's verify handler in the manifest", async () => {
548
+ const { manifestPath } = await buildApp(fixture("webhook-verify"));
549
+
550
+ expect(JSON.parse(await fs.promises.readFile(manifestPath, "utf8"))).toMatchObject({
551
+ capabilities: [
552
+ {
553
+ type: "workflow",
554
+ key: "onIncoming",
555
+ config: {
556
+ name: "Incoming Webhook",
557
+ description: "Verifies and processes an incoming webhook",
558
+ triggers: [{ type: "webhooks.webhook", hasVerify: true }],
559
+ },
560
+ },
561
+ ],
562
+ });
563
+ });
564
+
547
565
  it("collects relation databases and a shared pacer once", async () => {
548
566
  const { manifest } = await buildApp(fixture("shared-primary-key"));
549
567
 
@@ -20,6 +20,20 @@ describe("generateEntry", () => {
20
20
  expect(entry).toContain("export async function run(");
21
21
  });
22
22
 
23
+ it("resolves the webhook verify invocation type to the workflow registry", () => {
24
+ const entry = generateEntry([
25
+ {
26
+ type: "workflow",
27
+ tag: "workflow",
28
+ key: "onIncoming",
29
+ sourcePath: "src/workflows/onIncoming.ts",
30
+ runtime: "worker",
31
+ },
32
+ ]);
33
+
34
+ expect(entry).toContain(`workflowWebhookVerify: "workflow",`);
35
+ });
36
+
23
37
  it("registers syncs in their own capability group", () => {
24
38
  const entry = generateEntry([
25
39
  {
@@ -37,16 +37,24 @@ export const capabilities: Record<string, Record<string, { handler: Handler }>>
37
37
  ${registry}
38
38
  };
39
39
 
40
+ // The platform dispatches a workflow's synchronous webhook verify run under its
41
+ // own invocation type. It resolves to the same capability, which tells a verify
42
+ // invocation from a trigger event by the shape of its input.
43
+ const invocationTypes: Record<string, string | undefined> = {
44
+ workflowWebhookVerify: "workflow",
45
+ };
46
+
40
47
  export async function run(
41
48
  type: string,
42
49
  key: string,
43
50
  context?: unknown,
44
51
  options?: { concreteOutput?: true },
45
52
  ): Promise<unknown> {
46
- const capability = capabilities[type]?.[key];
53
+ const capabilityType = invocationTypes[type] ?? type;
54
+ const capability = capabilities[capabilityType]?.[key];
47
55
 
48
56
  if (!capability) {
49
- throw new Error(\`Capability "\${type}/\${key}" not found\`);
57
+ throw new Error(\`Capability "\${capabilityType}/\${key}" not found\`);
50
58
  }
51
59
 
52
60
  return capability.handler(context, options);
@@ -18,7 +18,8 @@ describe("Notion-as-Code custom agent declarations", () => {
18
18
  resourceId: "triage-agent",
19
19
  name: "Triage agent",
20
20
  webAccess: true,
21
- trustedUrls: { type: "all" },
21
+ browserUse: true,
22
+ trustedUrls: ["docs.example.com/*", "support.example.com"],
22
23
  access: [access.edit(tasks)],
23
24
  triggers: [
24
25
  {
@@ -30,6 +31,11 @@ describe("Notion-as-Code custom agent declarations", () => {
30
31
  timeZone: "America/Los_Angeles",
31
32
  weekdays: { MO: true, FR: true },
32
33
  },
34
+ {
35
+ type: "page_added",
36
+ resourceId: "task-added-trigger",
37
+ dataSourceResourceId: "tasks",
38
+ },
33
39
  {
34
40
  type: "property_updated",
35
41
  resourceId: "task-update-trigger",
@@ -48,7 +54,8 @@ describe("Notion-as-Code custom agent declarations", () => {
48
54
  resourceId: "triage-agent",
49
55
  name: "Triage agent",
50
56
  webAccess: true,
51
- trustedUrls: { type: "all" },
57
+ browserUse: true,
58
+ trustedUrls: { type: "list", urls: ["docs.example.com/*", "support.example.com"] },
52
59
  access: [{ resourceId: "tasks-db", level: "edit" }],
53
60
  triggers: [
54
61
  {
@@ -60,9 +67,16 @@ describe("Notion-as-Code custom agent declarations", () => {
60
67
  timeZone: "America/Los_Angeles",
61
68
  weekdays: { MO: true, FR: true },
62
69
  },
70
+ {
71
+ type: "page_added",
72
+ resourceId: "task-added-trigger",
73
+ dataSourceResourceId: "tasks",
74
+ waitForEditsToFinish: false,
75
+ },
63
76
  {
64
77
  type: "property_updated",
65
78
  resourceId: "task-update-trigger",
79
+ waitForEditsToFinish: false,
66
80
  dataSourceResourceId: "tasks",
67
81
  propertyConditions: {
68
82
  status: { type: "property_edited" },
@@ -74,6 +88,72 @@ describe("Notion-as-Code custom agent declarations", () => {
74
88
  ]);
75
89
  });
76
90
 
91
+ it("records browser disablement and no trusted URLs", () => {
92
+ const recorder = startMetadataRecording();
93
+ notion.customAgent({
94
+ resourceId: "triage-agent",
95
+ name: "Triage agent",
96
+ browserUse: false,
97
+ trustedUrls: "none",
98
+ });
99
+ expect(finishMetadataRecording(recorder).intents).toEqual([
100
+ {
101
+ type: "custom_agent",
102
+ resourceId: "triage-agent",
103
+ name: "Triage agent",
104
+ browserUse: false,
105
+ trustedUrls: { type: "list", urls: [] },
106
+ },
107
+ ]);
108
+ });
109
+
110
+ it("records unrestricted trust and an explicit wait for edits", () => {
111
+ const recorder = startMetadataRecording();
112
+ notion.customAgent({
113
+ resourceId: "triage-agent",
114
+ name: "Triage agent",
115
+ trustedUrls: "all",
116
+ triggers: [
117
+ {
118
+ type: "page_added",
119
+ resourceId: "task-added-trigger",
120
+ dataSourceResourceId: "tasks",
121
+ waitForEditsToFinish: true,
122
+ },
123
+ {
124
+ type: "property_updated",
125
+ resourceId: "task-update-trigger",
126
+ dataSourceResourceId: "tasks",
127
+ triggerWhenPageContentEdited: true,
128
+ waitForEditsToFinish: true,
129
+ },
130
+ ],
131
+ });
132
+ expect(finishMetadataRecording(recorder).intents).toEqual([
133
+ {
134
+ type: "custom_agent",
135
+ resourceId: "triage-agent",
136
+ name: "Triage agent",
137
+ trustedUrls: { type: "all" },
138
+ triggers: [
139
+ {
140
+ type: "page_added",
141
+ resourceId: "task-added-trigger",
142
+ dataSourceResourceId: "tasks",
143
+ waitForEditsToFinish: true,
144
+ },
145
+ {
146
+ type: "property_updated",
147
+ resourceId: "task-update-trigger",
148
+ dataSourceResourceId: "tasks",
149
+ triggerWhenPageContentEdited: true,
150
+ waitForEditsToFinish: true,
151
+ },
152
+ ],
153
+ },
154
+ ]);
155
+ });
156
+
77
157
  it("rejects reserved resource IDs inside triggers", () => {
78
158
  expect(() =>
79
159
  notion.customAgent({
@@ -33,6 +33,8 @@ export type PropertyTriggerCondition = {
33
33
  export type CustomAgentPageAddedTrigger = CustomAgentTriggerBase & {
34
34
  type: "page_added";
35
35
  dataSourceResourceId: ResourceId;
36
+ /** Wait for follow-up edits before running the agent. Defaults to false in Apps. */
37
+ waitForEditsToFinish?: boolean;
36
38
  };
37
39
 
38
40
  type PropertyUpdatedTriggerTarget =
@@ -49,6 +51,8 @@ export type CustomAgentPropertyUpdatedTrigger = CustomAgentTriggerBase &
49
51
  PropertyUpdatedTriggerTarget & {
50
52
  type: "property_updated";
51
53
  dataSourceResourceId: ResourceId;
54
+ /** Wait for follow-up edits before running the agent. Defaults to false in Apps. */
55
+ waitForEditsToFinish?: boolean;
52
56
  };
53
57
 
54
58
  export type CustomAgentTrigger =
@@ -68,15 +72,8 @@ export type CustomAgentAccess = Extract<
68
72
  { readonly resource: { readonly resourceType: "page" | "database" } }
69
73
  >;
70
74
 
71
- /**
72
- * URL trust settings for a custom agent.
73
- *
74
- * URL trust is independent from web access: an agent can trust URLs without
75
- * being granted web search access.
76
- */
77
- export type CustomAgentTrustedUrls = {
78
- type: "all";
79
- };
75
+ /** Trust every URL, trust no URLs, or trust a nonempty list of up to 20 URL globs. */
76
+ export type CustomAgentTrustedUrls = "all" | "none" | [string, ...string[]];
80
77
 
81
78
  export type CustomAgentArgs = {
82
79
  resourceId: ResourceId;
@@ -84,6 +81,8 @@ export type CustomAgentArgs = {
84
81
  icon?: Exclude<NotionAsCodeIcon, { type: "file" }>;
85
82
  instructions?: string;
86
83
  model?: "ambrosia-tart-high" | "opal-quince-medium" | "almond-croissant-low";
84
+ /** Whether the agent can use the Web Browser. Omission preserves the existing setting. */
85
+ browserUse?: boolean;
87
86
  /**
88
87
  * Whether the agent can use web search. Defaults to `false` when omitted for
89
88
  * a new agent. When updating an existing agent, omitting this field preserves
@@ -91,9 +90,10 @@ export type CustomAgentArgs = {
91
90
  */
92
91
  webAccess?: boolean;
93
92
  /**
94
- * URL trust policy for this agent. `{ type: "all" }` allows every HTTP and
95
- * HTTPS URL. For a new agent, omitting this field leaves URL trust disabled;
96
- * for an existing agent, omission preserves the current URL trust policy.
93
+ * Set `"all"` to trust every HTTP and HTTPS URL, `"none"` to disable URL
94
+ * trust, or provide a nonempty list of up to 20 URL globs. Omission leaves
95
+ * trust disabled for a new agent and preserves it for an existing agent.
96
+ * URL trust is independent from web search.
97
97
  */
98
98
  trustedUrls?: CustomAgentTrustedUrls;
99
99
  /**
@@ -135,13 +135,31 @@ export function customAgent(args: CustomAgentArgs): CustomAgentHandle {
135
135
  }
136
136
  }
137
137
  }
138
- const { access: _access, ...intent } = args;
138
+ const { access: _access, trustedUrls, triggers, ...intent } = args;
139
139
  recordIntent({
140
140
  type: "custom_agent",
141
141
  ...intent,
142
+ ...(trustedUrls === undefined ? {} : { trustedUrls: toTrustedUrlsIntent(trustedUrls) }),
143
+ ...(triggers === undefined ? {} : { triggers: triggers.map(toTriggerIntent) }),
142
144
  ...(grants === undefined ? {} : { access: grants }),
143
145
  } satisfies {
144
146
  type: "custom_agent";
145
147
  } & CustomAgentIntent);
146
148
  return { resourceType: "customAgent", resourceId: args.resourceId };
147
149
  }
150
+
151
+ function toTriggerIntent(trigger: CustomAgentTrigger): CustomAgentTrigger {
152
+ if (trigger.type === "recurrence") {
153
+ return trigger;
154
+ }
155
+ return { ...trigger, waitForEditsToFinish: trigger.waitForEditsToFinish ?? false };
156
+ }
157
+
158
+ function toTrustedUrlsIntent(
159
+ trustedUrls: CustomAgentTrustedUrls,
160
+ ): NonNullable<CustomAgentIntent["trustedUrls"]> {
161
+ if (trustedUrls === "all") {
162
+ return { type: "all" };
163
+ }
164
+ return { type: "list", urls: trustedUrls === "none" ? [] : [...trustedUrls] };
165
+ }
@@ -347,7 +347,8 @@ export type DatabaseIntent = {
347
347
  };
348
348
 
349
349
  export type PageIntent = PageArgs & { parent: Parent };
350
- export type CustomAgentIntent = Omit<CustomAgentArgs, "access"> & {
350
+ export type CustomAgentIntent = Omit<CustomAgentArgs, "access" | "trustedUrls"> & {
351
+ trustedUrls?: { type: "all" } | { type: "list"; urls: string[] };
351
352
  access?: readonly { resourceId: ResourceId; level: ResourceAccessLevel }[];
352
353
  };
353
354
 
@@ -37,8 +37,11 @@ it("types custom agent resource access and URL trust", () => {
37
37
  expectTypeOf(
38
38
  access.call(customAgent({ resourceId: "agent", name: "Agent" })),
39
39
  ).not.toExtend<CustomAgentAccess>();
40
- expectTypeOf<{ type: "all" }>().toEqualTypeOf<CustomAgentTrustedUrls>();
40
+ expectTypeOf<CustomAgentTrustedUrls>().toEqualTypeOf<"all" | "none" | [string, ...string[]]>();
41
+ expectTypeOf<[]>().not.toExtend<CustomAgentTrustedUrls>();
42
+ expectTypeOf<{ type: "all" }>().not.toExtend<CustomAgentTrustedUrls>();
41
43
  expectTypeOf<CustomAgentArgs["webAccess"]>().toEqualTypeOf<boolean | undefined>();
44
+ expectTypeOf<CustomAgentArgs["browserUse"]>().toEqualTypeOf<boolean | undefined>();
42
45
  expectTypeOf<CustomAgentArgs["trustedUrls"]>().toEqualTypeOf<
43
46
  CustomAgentTrustedUrls | undefined
44
47
  >();
@@ -7,7 +7,7 @@ import { afterEach, beforeEach, describe, expect, expectTypeOf, it, vi, type Moc
7
7
 
8
8
  import { ExecutionError } from "./error.js";
9
9
  import type { RunMetadata } from "./runtime-metadata.js";
10
- import { events, type NotionPageCreatedEvent } from "./events.generated.js";
10
+ import { events, type NotionPageCreatedEvent, type WebhookEvent } from "./events.generated.js";
11
11
  import { customAgent } from "./notion-as-code/custom-agent.js";
12
12
  import { database } from "./notion-as-code/database.js";
13
13
  import { page } from "./notion-as-code/page.js";
@@ -17,6 +17,7 @@ import {
17
17
  input,
18
18
  workflow,
19
19
  type StepContext,
20
+ type WebhookVerifyHandler,
20
21
  type WorkflowContext,
21
22
  type WorkflowInputDate,
22
23
  type WorkflowWaitDuration,
@@ -1621,3 +1622,240 @@ describe("connection-bound triggers", () => {
1621
1622
  ).not.toThrow();
1622
1623
  });
1623
1624
  });
1625
+
1626
+ describe("workflow verify", () => {
1627
+ const verifyRequest = {
1628
+ method: "POST" as const,
1629
+ url: "https://123456.webhook.notionusercontent.com/webhooks/app/s/w/u/incoming",
1630
+ query: {},
1631
+ headers: { "x-signature": "sig" },
1632
+ rawBody: '{"challenge":"abc"}',
1633
+ };
1634
+
1635
+ it("marks the webhook trigger with hasVerify when a verify handler is set", () => {
1636
+ const incoming = workflow({
1637
+ name: "Incoming",
1638
+ description: "Processes an incoming webhook",
1639
+ triggers: [events.webhook()],
1640
+ verify: () => ({ status: 200 }),
1641
+ handler: () => {},
1642
+ });
1643
+
1644
+ expect(incoming.config).toEqual({
1645
+ name: "Incoming",
1646
+ description: "Processes an incoming webhook",
1647
+ triggers: [{ type: "webhooks.webhook", hasVerify: true }],
1648
+ });
1649
+ });
1650
+
1651
+ it("flags only the webhook trigger among a workflow's triggers", () => {
1652
+ const incoming = workflow({
1653
+ name: "Incoming",
1654
+ description: "Processes an incoming webhook",
1655
+ triggers: [events.notionPageCreated(), events.webhook()],
1656
+ verify: () => ({ status: 200 }),
1657
+ handler: () => {},
1658
+ });
1659
+
1660
+ expect(incoming.config.triggers).toEqual([
1661
+ { type: "notion.page.created" },
1662
+ { type: "webhooks.webhook", hasVerify: true },
1663
+ ]);
1664
+ });
1665
+
1666
+ it("omits hasVerify from the trigger when no verify handler is set", () => {
1667
+ const incoming = workflow({
1668
+ name: "Incoming",
1669
+ description: "Processes an incoming webhook",
1670
+ triggers: [events.webhook()],
1671
+ handler: () => {},
1672
+ });
1673
+
1674
+ expect(incoming.config.triggers).toEqual([{ type: "webhooks.webhook" }]);
1675
+ });
1676
+
1677
+ it("rejects a verify handler on a workflow without a webhook trigger", () => {
1678
+ expect(() =>
1679
+ workflow({
1680
+ name: "Log Pages",
1681
+ description: "Logs created pages",
1682
+ triggers: [events.notionPageCreated()],
1683
+ verify: () => ({ status: 200 }),
1684
+ handler: () => {},
1685
+ }),
1686
+ ).toThrow(/has no webhook trigger/);
1687
+ });
1688
+
1689
+ it("dispatches a verify invocation to the verify handler, not the workflow handler", async () => {
1690
+ const handler = vi.fn();
1691
+ const verify: WebhookVerifyHandler = (request) => ({
1692
+ status: 200,
1693
+ body: (JSON.parse(request.rawBody) as { challenge: string }).challenge,
1694
+ contentType: "text/plain",
1695
+ });
1696
+ const incoming = workflow({
1697
+ name: "Incoming",
1698
+ description: "Processes an incoming webhook",
1699
+ triggers: [events.webhook()],
1700
+ verify,
1701
+ handler,
1702
+ });
1703
+
1704
+ const response = await incoming.handler(
1705
+ { request: verifyRequest },
1706
+ { concreteOutput: true },
1707
+ );
1708
+
1709
+ expect(response).toEqual({ status: 200, body: "abc", contentType: "text/plain" });
1710
+ expect(handler).not.toHaveBeenCalled();
1711
+ });
1712
+
1713
+ it("returns an explicit delivery decision from the verify handler", async () => {
1714
+ const incoming = workflow({
1715
+ name: "Incoming",
1716
+ description: "Processes an incoming webhook",
1717
+ triggers: [events.webhook()],
1718
+ verify: () => ({ status: 200, deliver: false }),
1719
+ handler: () => {},
1720
+ });
1721
+
1722
+ const response = await incoming.handler(
1723
+ { request: verifyRequest },
1724
+ { concreteOutput: true },
1725
+ );
1726
+
1727
+ expect(response).toEqual({ status: 200, deliver: false });
1728
+ });
1729
+
1730
+ it("passes the capability context to the verify handler", async () => {
1731
+ let receivedContext: unknown;
1732
+ const incoming = workflow({
1733
+ name: "Incoming",
1734
+ description: "Processes an incoming webhook",
1735
+ triggers: [events.webhook()],
1736
+ verify: (_request, context) => {
1737
+ receivedContext = context;
1738
+ return { status: 200 };
1739
+ },
1740
+ handler: () => {},
1741
+ });
1742
+
1743
+ await incoming.handler({ request: verifyRequest }, { concreteOutput: true });
1744
+
1745
+ expect(receivedContext).toHaveProperty("notion");
1746
+ expect(receivedContext).not.toHaveProperty("step");
1747
+ });
1748
+
1749
+ it("verifies without workflow run metadata", async () => {
1750
+ delete process.env.NOTION_RUN_METADATA_PATH;
1751
+ const incoming = workflow({
1752
+ name: "Incoming",
1753
+ description: "Processes an incoming webhook",
1754
+ triggers: [events.webhook()],
1755
+ verify: () => ({ status: 200 }),
1756
+ handler: () => {},
1757
+ });
1758
+
1759
+ await expect(
1760
+ incoming.handler({ request: verifyRequest }, { concreteOutput: true }),
1761
+ ).resolves.toEqual({ status: 200 });
1762
+ });
1763
+
1764
+ it("writes the verify response as a success envelope without concreteOutput", async () => {
1765
+ const incoming = workflow({
1766
+ name: "Incoming",
1767
+ description: "Processes an incoming webhook",
1768
+ triggers: [events.webhook()],
1769
+ verify: () => ({ status: 401 }),
1770
+ handler: () => {},
1771
+ });
1772
+
1773
+ await incoming.handler({ request: verifyRequest });
1774
+
1775
+ expect(stdoutSpy).toHaveBeenCalledWith(
1776
+ expect.stringContaining('"_tag":"success","value":{"status":401}'),
1777
+ );
1778
+ });
1779
+
1780
+ it("runs in the app bundle, so verify handlers may capture module scope", async () => {
1781
+ const signingSecret = "shh";
1782
+ const incoming = workflow({
1783
+ name: "Incoming",
1784
+ description: "Processes an incoming webhook",
1785
+ triggers: [events.webhook()],
1786
+ verify: (request) => ({
1787
+ status: request.headers["x-signature"] === signingSecret ? 200 : 401,
1788
+ }),
1789
+ handler: () => {},
1790
+ });
1791
+
1792
+ const response = await incoming.handler(
1793
+ { request: { ...verifyRequest, headers: { "x-signature": "shh" } } },
1794
+ { concreteOutput: true },
1795
+ );
1796
+
1797
+ expect(response).toEqual({ status: 200 });
1798
+ });
1799
+
1800
+ it("uses a file-backed verify request instead of the inline invocation", async () => {
1801
+ if (!metadataDirectory) {
1802
+ throw new Error("Metadata directory was not created");
1803
+ }
1804
+ const payloadPath = join(metadataDirectory, "verify-input.json");
1805
+ await writeFile(
1806
+ payloadPath,
1807
+ JSON.stringify({ request: { ...verifyRequest, rawBody: '{"challenge":"file"}' } }),
1808
+ );
1809
+ process.env.NOTION_INPUT_PAYLOAD_PATH = payloadPath;
1810
+
1811
+ const incoming = workflow({
1812
+ name: "Incoming",
1813
+ description: "Processes an incoming webhook",
1814
+ triggers: [events.webhook()],
1815
+ verify: (request) => ({
1816
+ status: 200,
1817
+ body: (JSON.parse(request.rawBody) as { challenge: string }).challenge,
1818
+ }),
1819
+ handler: () => {},
1820
+ });
1821
+
1822
+ const response = await incoming.handler(
1823
+ { request: verifyRequest },
1824
+ { concreteOutput: true },
1825
+ );
1826
+
1827
+ expect(response).toEqual({ status: 200, body: "file" });
1828
+ });
1829
+
1830
+ it("still dispatches trigger events to the workflow handler when verify is configured", async () => {
1831
+ const handler = vi.fn();
1832
+ const webhookEvent = { type: "webhooks.webhook" } as WebhookEvent;
1833
+ const incoming = workflow({
1834
+ name: "Incoming",
1835
+ description: "Processes an incoming webhook",
1836
+ triggers: [events.webhook()],
1837
+ verify: () => ({ status: 200 }),
1838
+ handler,
1839
+ });
1840
+
1841
+ const result = await incoming.handler(webhookEvent, { concreteOutput: true });
1842
+
1843
+ expect(result).toEqual({ status: "success" });
1844
+ expect(handler).toHaveBeenCalledWith(webhookEvent, expect.anything());
1845
+ });
1846
+
1847
+ it("rejects a verify invocation when no verify handler is declared", async () => {
1848
+ const handler = vi.fn();
1849
+ const incoming = workflow({
1850
+ name: "Incoming",
1851
+ description: "Processes an incoming webhook",
1852
+ triggers: [events.webhook()],
1853
+ handler,
1854
+ });
1855
+
1856
+ await expect(
1857
+ incoming.handler({ request: verifyRequest }, { concreteOutput: true }),
1858
+ ).rejects.toThrow(/does not declare a verify handler/);
1859
+ expect(handler).not.toHaveBeenCalled();
1860
+ });
1861
+ });
package/src/workflow.ts CHANGED
@@ -26,6 +26,7 @@ import { readRunMetadata, type RunMetadata } from "./runtime-metadata.js";
26
26
  import { createWorkflowEvents } from "./events.generated.js";
27
27
  import { createWorkflowStepState, type WorkflowState } from "./workflow-state.js";
28
28
  import type {
29
+ WebhookTrigger,
29
30
  WorkflowEventMap,
30
31
  WorkflowTrigger,
31
32
  WorkflowEventCreators,
@@ -37,6 +38,9 @@ type HandlerOptions = {
37
38
  concreteOutput?: true;
38
39
  };
39
40
 
41
+ /** The only trigger whose deliveries a verify handler can answer. */
42
+ const WEBHOOK_TRIGGER_TYPE: WebhookTrigger["type"] = "webhooks.webhook";
43
+
40
44
  type WorkflowWaitDurationValues = {
41
45
  milliseconds?: number;
42
46
  seconds?: number;
@@ -215,6 +219,73 @@ export {
215
219
  type OAuthConnection,
216
220
  } from "./connections.js";
217
221
 
222
+ /**
223
+ * The inbound HTTP request passed to a webhook verify handler.
224
+ */
225
+ export type WebhookVerifyRequest = {
226
+ /** Uppercase HTTP method. Deliveries are POSTs; GET/HEAD cover challenge probes. */
227
+ method: "GET" | "HEAD" | "POST";
228
+ /** The full webhook URL as received. */
229
+ url: string;
230
+ /** Query string parameters. */
231
+ query: Record<string, string>;
232
+ /** Request headers with lowercased names. */
233
+ headers: Record<string, string>;
234
+ /** Raw request body. Empty string for bodyless methods like GET and HEAD. */
235
+ rawBody: string;
236
+ };
237
+
238
+ /**
239
+ * The HTTP response a verify handler produces. `deliver`, when present,
240
+ * explicitly controls whether the request is enqueued for the workflow
241
+ * handler. Otherwise delivery is derived from the status: 2xx enqueues and 4xx
242
+ * does not.
243
+ */
244
+ export type WebhookVerifyResponse = {
245
+ /** Response status code. Only 2xx and 4xx statuses are allowed. */
246
+ status: number;
247
+ /** Optional response body, at most 8KB. */
248
+ body?: string;
249
+ /** Response content type. Defaults to "text/plain". */
250
+ contentType?: "application/json" | "text/plain";
251
+ /**
252
+ * Whether to enqueue the request for the workflow handler. Defaults to true
253
+ * for 2xx responses and false for 4xx responses.
254
+ */
255
+ deliver?: boolean;
256
+ };
257
+
258
+ /**
259
+ * A webhook verify handler. Runs synchronously at Notion's webhook ingress,
260
+ * before the HTTP response is sent, in the app's own sandbox — the same
261
+ * runtime as the workflow handler, with the full Node.js standard library.
262
+ * Read signing secrets from `process.env` and use `node:crypto` for
263
+ * signature checks.
264
+ *
265
+ * Keep it fast: the run must fit a small wall-clock budget (a few seconds,
266
+ * including sandbox startup), so avoid network calls — including
267
+ * `context.notion` API calls, which typically won't fit the budget.
268
+ */
269
+ export type WebhookVerifyHandler = (
270
+ request: WebhookVerifyRequest,
271
+ context: CapabilityContext,
272
+ ) => WebhookVerifyResponse | Promise<WebhookVerifyResponse>;
273
+
274
+ /**
275
+ * A verify invocation as dispatched by the platform: a single `request`
276
+ * object rather than the event a workflow invocation carries.
277
+ */
278
+ export type WebhookVerifyInvocation = {
279
+ request: WebhookVerifyRequest;
280
+ };
281
+
282
+ /**
283
+ * A trigger as the manifest records it. A declared `verify` handler is flagged
284
+ * on the webhook trigger itself, which is where the platform reads it to decide
285
+ * whether to run `verify` at webhook ingress.
286
+ */
287
+ export type WorkflowManifestTrigger = WorkflowTrigger | (WebhookTrigger & { hasVerify: true });
288
+
218
289
  /**
219
290
  * Configuration passed to {@link workflow}.
220
291
  */
@@ -252,6 +323,40 @@ export type WorkflowConfiguration<
252
323
  */
253
324
  connections?: TConnections;
254
325
 
326
+ /**
327
+ * Optional synchronous verification handler, run at Notion's webhook
328
+ * ingress before the HTTP response is sent. Use it for providers that
329
+ * require a synchronous verification response: signature checks with
330
+ * specific status codes, challenge echoes, or handshake requests.
331
+ *
332
+ * Only workflows with an `events.webhook()` trigger may declare one.
333
+ *
334
+ * The handler controls the HTTP response. Return `deliver: true` to enqueue
335
+ * the request for the workflow handler, or `deliver: false` to answer the
336
+ * provider without enqueueing it. When omitted, 2xx enqueues and 4xx does
337
+ * not. `verify` runs in the app's own sandbox with full Node.js — read
338
+ * secrets from `process.env` and use `node:crypto` for signature checks. It
339
+ * receives the capability context as its second argument, without the run
340
+ * metadata and `step` a workflow run carries.
341
+ *
342
+ * Without `verify`, the webhook keeps the current behavior: every request
343
+ * is accepted with `202` and processed asynchronously.
344
+ *
345
+ * @example
346
+ * ```ts
347
+ * verify: (request) => {
348
+ * const signature = createHmac("sha256", process.env.WEBHOOK_SECRET ?? "")
349
+ * .update(request.rawBody)
350
+ * .digest("hex");
351
+ * const expected = Buffer.from(`sha256=${signature}`);
352
+ * const actual = Buffer.from(request.headers["x-hub-signature-256"] ?? "");
353
+ * const verified = expected.length === actual.length && timingSafeEqual(expected, actual);
354
+ * return verified ? { status: 200 } : { status: 401, body: "Invalid signature" };
355
+ * },
356
+ * ```
357
+ */
358
+ verify?: WebhookVerifyHandler;
359
+
255
360
  handler: (
256
361
  event: WorkflowEventForTriggers<TTriggers>,
257
362
  context: WorkflowContext<TConnections, TAccess>,
@@ -283,14 +388,14 @@ export type Workflow<
283
388
  config: {
284
389
  name: string;
285
390
  description: string;
286
- triggers: TTriggers;
391
+ triggers: WorkflowManifestTrigger[];
287
392
  connections?: readonly WorkflowConnectionRequirement[];
288
393
  access?: WorkflowAccessRequirements;
289
394
  };
290
395
  handler: (
291
- event: WorkflowEventForTriggers<TTriggers>,
396
+ input: WorkflowEventForTriggers<TTriggers> | WebhookVerifyInvocation,
292
397
  options?: HandlerOptions,
293
- ) => Promise<WorkflowHandlerResult | undefined>;
398
+ ) => Promise<WorkflowHandlerResult | WebhookVerifyResponse | undefined>;
294
399
  };
295
400
 
296
401
  /**
@@ -355,21 +460,54 @@ export function workflow<
355
460
  : configuration.triggers;
356
461
  validateTriggerConnections(triggers, requirements);
357
462
 
463
+ if (
464
+ configuration.verify !== undefined &&
465
+ !triggers.some((trigger) => trigger.type === WEBHOOK_TRIGGER_TYPE)
466
+ ) {
467
+ throw new Error(
468
+ `Workflow "${configuration.name}" declares a verify handler but has no webhook trigger. ` +
469
+ `Add events.webhook() or remove verify.`,
470
+ );
471
+ }
472
+
358
473
  return {
359
474
  _tag: "workflow",
360
475
  config: {
361
476
  name: configuration.name,
362
477
  description: configuration.description,
363
- triggers,
478
+ triggers: manifestTriggers(triggers, configuration.verify !== undefined),
364
479
  ...(configuration.connections === undefined ? {} : { connections: requirements }),
365
480
  ...(configuration.access === undefined ? {} : { access: accessRequirements }),
366
481
  },
367
482
  async handler(
368
- event: WorkflowEventForTriggers<TTriggers>,
483
+ input: WorkflowEventForTriggers<TTriggers> | WebhookVerifyInvocation,
369
484
  options?: HandlerOptions,
370
- ): Promise<WorkflowHandlerResult | undefined> {
485
+ ): Promise<WorkflowHandlerResult | WebhookVerifyResponse | undefined> {
371
486
  try {
372
- event = await resolveRuntimeInput(event);
487
+ input = await resolveRuntimeInput(input);
488
+
489
+ if (isVerifyInvocation(input)) {
490
+ if (configuration.verify === undefined) {
491
+ throw new Error(
492
+ `Workflow "${configuration.name}" received a verify request but does not ` +
493
+ `declare a verify handler`,
494
+ );
495
+ }
496
+
497
+ const response = await configuration.verify(
498
+ input.request,
499
+ createCapabilityContext(),
500
+ );
501
+
502
+ if (options?.concreteOutput) {
503
+ return response;
504
+ }
505
+
506
+ writeOutput({ _tag: "success", value: response });
507
+ return undefined;
508
+ }
509
+
510
+ const event = input;
373
511
  const runMetadata = readRunMetadata();
374
512
  const baseContext = createCapabilityContext();
375
513
  const step = createStep(runMetadata);
@@ -423,6 +561,31 @@ export function workflow<
423
561
  };
424
562
  }
425
563
 
564
+ /**
565
+ * The triggers as the manifest records them. The manifest only records that a
566
+ * verify handler exists, flagged on the webhook trigger; the handler itself
567
+ * ships in the app bundle and runs via a verify invocation.
568
+ */
569
+ function manifestTriggers(
570
+ triggers: readonly WorkflowTrigger[],
571
+ hasVerify: boolean,
572
+ ): WorkflowManifestTrigger[] {
573
+ return triggers.map((trigger) =>
574
+ hasVerify && trigger.type === WEBHOOK_TRIGGER_TYPE
575
+ ? { ...trigger, hasVerify: true as const }
576
+ : trigger,
577
+ );
578
+ }
579
+
580
+ /**
581
+ * Whether an invocation is the platform's synchronous verify dispatch. The
582
+ * platform sends workflow invocations as a trigger event and verify
583
+ * invocations as a `{ request }` object, so the shape disambiguates.
584
+ */
585
+ function isVerifyInvocation(input: unknown): input is WebhookVerifyInvocation {
586
+ return typeof input === "object" && input !== null && "request" in input;
587
+ }
588
+
426
589
  /** Context passed to a workflow step. */
427
590
  export type StepContext = {
428
591
  /**