First, you have to think about how Salesforce is going to process these notifications from Google. The answer to this will drive the domain verification method. Let's say you create a custom Apex REST web service in Salesforce that will act as a webhook for receiving notifications. The URL of the webhook in Salesforce will depend on where the webhook resides. Out of the box, the URL of a Apex REST web service is going to be
somedomain.my.salesforce.com is a Salesforce org that implements My Domain and
myWebHook is the name of the webhook (tutorial)
If you attempt to verify
https://somedomain.my.salesforce.com/services/apexrest/myWebHook in Google, you will have two options: a DNS change for
somedomain.my.salesforce.com OR a URL prefix option. In this latter scenario Google allows multiple verification methods, upload of a HTML file to your "website" being one of them:
You can verify ownership of a site by uploading a special HTML file to
your site. This file is tied to a specific user. Follow the
instructions on the verification details page. Removing this
verification file from your site will cause you to lose verification
for the site.
To verify ownership using a HTML file, choose the HTML file upload
method on the verification details page for your site, and follow the
The user agent that performs file upload verification has the user
Google-Site-Verification and the full user agent string
Mozilla/5.0 (compatible; Google-Site-Verification/1.0)
Out of the box with Salesforce and My Domain, you don't control the DNS. Salesforce issues the domain to you and it owns the DNS operations on that domain. Thus, you can't use the DNS verification option. If we consider the URL prefix verification option, there's no "website" in Saleforce, at least not out of the box.
The solution you need requires a combination of two capabilities in Salesforce:
- Webhook that accepts calls from Google Drive
- DNS ownership OR a web site that acts as a "parent" to the webhook
Custom domain. Instead of Saleforce issuing a domain, you via your own DNS provider can create a domain and use it in Salesforce. You could then have Google verify it via DNS. While this is possible and it represents the path of least resistance from a Google verification perspective, in Salesforce custom domains are painful. Among other things, custom domains only work in Production. Testing this entire solution in a non-production environment will be challenging, if not impossible.
A Site or a Community with a webhook underneath it. A Site or a Community in Salesforce will allow you to use the one of the URL prefix verification methods such as HTML file upload. You can then define your webhook and make it available via a Site or Community. One way of making the HTML file be available to Google for verification after uploading it is via a Visualforce page + static resource
UPDATE: In Spring '20, domain verification for external services is going to be available out of the box. This will work for My Domain or a Community domain.