Web-to-Case with reCAPTCHA

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.


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

  1. Sign in to your Google Account
  2. Go to the link, Recaptcha Link
  3. Click Get Recaptcha Button.
  4. Enter the Label
  5. Choose the type of Recaptcha, you want
web to case recaptcha
  1. Enter the domain where exactly your web to case form is hosted.
web to case recaptcha
  1. Check the “Accept the reCaptcha Terms of Service” checkbox.
  2. Click Register Button.
  3. Once the reCaptcha registration is done, a Site key and Secret key will be generated.

To generate the Web to Case form with “reCAPTCHA”, 

  1. Go to Setup [Symbol] Build [Symbol] Customize [Symbol]Self-Service [Symbol] Web-to-Case[Symbol] Check “Enable Web-to-Case” check box.
  2. Go to Setup [Symbol] Build [Symbol] Customize [Symbol]Self-Service [Symbol] Web-to-Case HTML Generator
  3. Include the necessary fields which are need to be in the form.
  4. Check the Enable spam filtering (recommended) check box.
  5. Click on the lookup icon in reCAPTCHA API Key Pair.
web to case recaptcha
  1. Click the New Button.
  2. Provide the API Key Pair Nickname, Secret Key and Site Key which generated earlier.
web to case recaptcha
  1. Click the Save button.
  2. 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.

web to case recaptcha

Client Side Integration 

web to case recaptcha

We can validate if the user submits form without checking the reCaptcha check box by using script,

web to case recaptcha
web to case recaptcha

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 KeyWhich is generated for your domain
responseA part of payload with string name ‘g-recaptcha-response’
remoteIPThe 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.

Reference Links: 

  1. https://releasenotes.docs.salesforce.com/en-us/spring17/release-notes/rn_web2case_recaptcha.htm
  2. https://help.salesforce.com/articleView?id=customizesupport_web_to_case_enable_recaptcha.htm&language=en_US&type=0
  3. https://developers.google.com/recaptcha/docs/verify

About MST

At MST Solutions our cornerstone is to adapt, engage and create solutions which guarantee the success of our clients. The talent of our team and experiences in varied business verticals gives us an advantage over other competitors.

Recent Articles

Work with us.

Our people aren’t just employees, they are key to the success of our business. We recognize the strengths of each individual and allow them time and resources to further develop those skills, crafting a culture of leaders who are passionate about where they are going within our organization.