How does Web-to-Lead generation work, and what security mechanisms protect against spam?
Answer
Basics: Marketing sites need to capture inquiries without staff re-typing them. Web-to-Lead produces a form you paste into any website. When a visitor submits, Salesforce creates a Lead, runs assignment and auto-response rules, and can notify the owner.
How it works: 1) Setup > Web-to-Lead; enable and set a Default Lead Creator. 2) Click Create Web-to-Lead Form, choose fields and a return URL, optionally tick "Include reCAPTCHA in HTML". 3) Paste the generated HTML on your site. The form posts to https://webto.salesforce.com/servlet/servlet.WebToLead with a hidden oid (your org ID). 4) Salesforce maps field names (standard API names, custom fields by 00N... ID) to a new Lead, applies lead assignment rules and auto-response rules, and fires triggers, flows and duplicate rules.
Advanced / deep dive: The oid is not secret, so anyone can post to your org; spam defense lives with you. Options: Google reCAPTCHA (Salesforce form generator supports it), a hidden honeypot field filtered by a validation rule or flow, validation rules on email and company, duplicate rules, and a middleware or Marketing Cloud Account Engagement (formerly Pardot) form handler for rate limiting. Server-side forms using the REST API with a Connected App avoid exposing a public endpoint but need credential handling. The platform enforces a daily Web-to-Lead cap (commonly documented as 500 per 24 hours); overflow leads are not created and the Default Lead Creator is emailed. Web-to-Case has a separate, higher cap.
Code / config example:
<form action="https://webto.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" =>