As we already know, we can generate Cases from Email and Web using Email-to-Case and Web-to-Case respectively. Now in Spring 17, Salesforce introduces a feature to include reCAPTCHA in the web-to-case from. So that we can avoid spam cases. This change applies to both Lightning Experience and Salesforce Classic.
Steps to get Recaptcha key
Prerequisite: We need to have Google Account
- Sign in to your Google Account
- Go to the link, Recaptcha Link
- Click Get Recaptcha Button.
- Enter the Label
- Choose the type of Recaptcha, you want
- Enter the domain where exactly your web to case form is hosted.
- Check the “Accept the reCaptcha Terms of Service” checkbox.
- Click Register Button.
- Once the reCaptcha registration is done, a Site key and Secret key will be generated.
To generate the Web to Case form with “reCAPTCHA”,
- Go to Setup [Symbol] Build [Symbol] Customize [Symbol]Self-Service [Symbol] Web-to-Case[Symbol] Check “Enable Web-to-Case” check box.
- Go to Setup [Symbol] Build [Symbol] Customize [Symbol]Self-Service [Symbol] Web-to-Case HTML Generator
- Include the necessary fields which are need to be in the form.
- Check the Enable spam filtering (recommended) check box.
- Click on the lookup icon in reCAPTCHA API Key Pair.
- Click the New Button.
- Provide the API Key Pair Nickname, Secret Key and Site Key which generated earlier.
- Click the Save button.
- Click the Generate Button.
HTML Code for web-to-case form is generated with the script to generate reCAPTCHA. Now, we can move our web-to-case form to a Visualforce page by including the reCAPTCHA script.
Client Side Integration
We can validate if the user submits form without checking the reCaptcha check box by using script,
Server Side Integration
For Server side Integration, we need to send a POST request to the URL, https://www.google.com/recaptcha/api/siteverify with the following parameters
|Secret Key||Which is generated for your domain|
|response||A part of payload with string name ‘g-recaptcha-response’|
|remoteIP||The end user’s IP Address|
Using reCaptcha, we can avoid spam Cases in Salesforce, so that customer service agents can focus on actual cases and not on the spam cases.