Secure API middleware for handling form submissions from Webflow and creating leads in Salesforce.
-
Install dependencies:
npm install
-
For local development:
# Copy the example environment file cp .dev.vars.example .dev.vars # Edit .dev.vars with your actual Salesforce credentials nano .dev.vars # Start local development server npm run dev
-
For production deployment:
# Set up Salesforce secrets in Cloudflare Workers wrangler secret put SALESFORCE_CLIENT_ID wrangler secret put SALESFORCE_CLIENT_SECRET wrangler secret put SALESFORCE_USERNAME wrangler secret put SALESFORCE_PASSWORD wrangler secret put SALESFORCE_SECURITY_TOKEN # Deploy to Cloudflare npm run deploy
POST /api/forms/individual- Individual customer registrationPOST /api/forms/organization- Organization customer registrationPOST /api/forms/referral- Referral registration
GET /docs- Interactive Swagger UI documentationGET /docs/spec.json- OpenAPI specification JSON
- Credentials stored as Cloudflare Workers secrets
- Input validation and sanitization
- CORS protection
- Rate limiting via Cloudflare
- No sensitive data logged
firstName/voornaam→ Lead.FirstNamelastName/achternaam→ Lead.LastNameemail→ Lead.Emailphone/telefoon→ Lead.Phone- Additional address and preference fields
- Contact person details → Lead fields
organizationName/naamOrganisatie→ Lead.Company
- Similar to individual with referral tracking