Data Webhook Tool
data_webhook_toolManage Webflow site webhooks: list, create, get details, or delete webhook registrations for specific trigger events.
Instructions
Data tool - Webhook tool to perform actions like list webhooks, create webhooks, get webhook details, and delete webhooks for a Webflow site.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| actions | Yes |
Implementation Reference
- src/tools/webhooks.ts:58-208 (registration)The tool 'data_webhook_tool' is registered via server.registerTool() with inputSchema defining actions (list_webhooks, create_webhook, get_webhook, delete_webhook).
server.registerTool( "data_webhook_tool", { title: "Data Webhook Tool", annotations: { readOnlyHint: false, openWorldHint: true, }, description: "Data tool - Webhook tool to perform actions like list webhooks, create webhooks, get webhook details, and delete webhooks for a Webflow site.", inputSchema: { actions: z.array( z .object({ // GET https://api.webflow.com/v2/sites/:site_id/webhooks list_webhooks: z .object({ site_id: z .string() .describe( "The site's unique ID, used to list its registered webhooks." ), }) .optional() .describe( "List all App-created webhooks registered for a given site. Returns webhook details including trigger type, URL, and creation date." ), // POST https://api.webflow.com/v2/sites/:site_id/webhooks create_webhook: z .object({ site_id: z .string() .describe( "The site's unique ID, used to create a webhook for this site." ), trigger_type: z .enum([ "form_submission", "site_publish", "page_created", "page_metadata_updated", "page_deleted", "ecomm_new_order", "ecomm_order_changed", "ecomm_inventory_changed", "user_account_added", "user_account_updated", "user_account_deleted", "collection_item_created", "collection_item_changed", "collection_item_deleted", "collection_item_published", "collection_item_unpublished", "comment_created", ]) .describe( "The type of event that triggers the webhook. Choose from 17 supported trigger types." ), url: z .string() .url() .describe( "The URL that will receive the webhook POST request when the event is triggered." ), filter: z .object({ name: z .string() .optional() .describe( "The name of the form to receive notifications for." ), }) .optional() .describe( "Only supported for the 'form_submission' trigger type. Filter for a specific form by name." ), }) .optional() .describe( "Create a new webhook for a site. Limit of 75 registrations per trigger type, per site." ), // GET https://api.webflow.com/v2/webhooks/:webhook_id get_webhook: z .object({ webhook_id: z .string() .describe( "The webhook's unique ID, used to retrieve its details." ), }) .optional() .describe( "Get detailed information about a specific webhook including its trigger type, URL, and last triggered date." ), // DELETE https://api.webflow.com/v2/webhooks/:webhook_id delete_webhook: z .object({ webhook_id: z .string() .describe( "The webhook's unique ID, used to identify which webhook to remove." ), }) .optional() .describe("Remove a webhook registration."), }) .strict() .refine( (d) => [ d.list_webhooks, d.create_webhook, d.get_webhook, d.delete_webhook, ].filter(Boolean).length >= 1, { message: "Provide at least one of list_webhooks, create_webhook, get_webhook, delete_webhook.", } ) ), }, }, async ({ actions }) => { const result: Content[] = []; try { for (const action of actions) { if (action.list_webhooks) { const content = await listWebhooks(action.list_webhooks); result.push(textContent(content)); } if (action.create_webhook) { const content = await createWebhook(action.create_webhook); result.push(textContent(content)); } if (action.get_webhook) { const content = await getWebhook(action.get_webhook); result.push(textContent(content)); } if (action.delete_webhook) { const content = await deleteWebhook(action.delete_webhook); result.push(textContent(content)); } } return toolResponse(result); } catch (error) { return formatErrorResponse(error); } } ); - src/tools/webhooks.ts:182-207 (handler)The handler callback for data_webhook_tool that processes each action (list, create, get, delete webhooks) by calling the appropriate helper functions.
async ({ actions }) => { const result: Content[] = []; try { for (const action of actions) { if (action.list_webhooks) { const content = await listWebhooks(action.list_webhooks); result.push(textContent(content)); } if (action.create_webhook) { const content = await createWebhook(action.create_webhook); result.push(textContent(content)); } if (action.get_webhook) { const content = await getWebhook(action.get_webhook); result.push(textContent(content)); } if (action.delete_webhook) { const content = await deleteWebhook(action.delete_webhook); result.push(textContent(content)); } } return toolResponse(result); } catch (error) { return formatErrorResponse(error); } } - src/tools/webhooks.ts:16-22 (helper)Helper function 'listWebhooks' that calls WebflowClient.webhooks.list().
const listWebhooks = async (arg: { site_id: string }) => { const response = await getClient().webhooks.list( arg.site_id, requestOptions ); return response; }; - src/tools/webhooks.ts:24-40 (helper)Helper function 'createWebhook' that calls WebflowClient.webhooks.create().
const createWebhook = async (arg: { site_id: string; trigger_type: string; url: string; filter?: { name?: string }; }) => { const response = await getClient().webhooks.create( arg.site_id, { triggerType: arg.trigger_type as any, url: arg.url, filter: arg.filter, }, requestOptions ); return response; }; - src/tools/webhooks.ts:42-48 (helper)Helper function 'getWebhook' that calls WebflowClient.webhooks.get().
const getWebhook = async (arg: { webhook_id: string }) => { const response = await getClient().webhooks.get( arg.webhook_id, requestOptions ); return response; }; - src/tools/webhooks.ts:50-56 (helper)Helper function 'deleteWebhook' that calls WebflowClient.webhooks.delete().
const deleteWebhook = async (arg: { webhook_id: string }) => { const response = await getClient().webhooks.delete( arg.webhook_id, requestOptions ); return response; };