How to configure webhooks to get notified of new PDF form submissions
This example showcases the use of a Node.js server to handle incoming webhooks from SimplePDF.
It saves in memory all "submission.created" events and surfaces the submission in a table view.
Clicking on each submission URL opens up the SimplePDF viewer for this specific submission
A live demo can be seen here: https://webhooks.simplepdf.com
This guide explains how to deploy the SimplePDF webhooks example to Cloudflare Workers (Free Plan compatible).
- Node.js installed
- Cloudflare account (free plan works)
- Wrangler CLI installed
npm installnpx wrangler loginThis will open a browser window to authenticate with your Cloudflare account.
Create a KV namespace to store webhook events:
npx wrangler kv:namespace create "SIMPLEPDF_WEBHOOKS_KV"This will output something like:
Created namespace with id "abc123def456"
Copy the namespace ID and update wrangler.toml:
[[kv_namespaces]]
binding = "SIMPLEPDF_WEBHOOKS_KV"
id = "YOUR_KV_NAMESPACE_ID" # Replace with your actual IDEdit wrangler.toml to customize the company identifier:
[vars]
COMPANY_IDENTIFIER = "your-company-name"npm run deployYour worker will be deployed and you'll receive a URL like:
https://simplepdf-webhooks.YOUR_SUBDOMAIN.workers.dev
Run the worker locally for testing:
npm run devThis will start a local development server at http://localhost:8787
The worker automatically cleans up submissions older than 15 minutes. The cron schedule is configured in wrangler.toml:
[triggers]
crons = ["*/15 * * * *"] # Runs every 15 minutesAvailable environment variables in wrangler.toml:
COMPANY_IDENTIFIER: Your SimplePDF company identifier (default: "webhooks-playground")
The Cloudflare Workers version has these key differences:
- Storage: Uses Cloudflare KV instead of in-memory arrays
- Cleanup: Uses Cron Triggers instead of setInterval
- Runtime: Uses Service Worker API instead of Express
- Stateless: Each request is independent, no shared state
GET /- Lists all submissionsGET /submissions/:id- View specific submission detailsPOST /webhooks- Receive webhook events from SimplePDFGET /flush- Clear all submissions
Events are stored in KV with keys: submission:{submissionId}
Each value is a JSON string containing the full webhook event payload.
A cron trigger runs every 15 minutes to delete submissions older than 15 minutes.