I am trying to set up Salesforce to receive Push notifications from Google drive whenever a file has been added by a user. I am following the steps documented here: https://developers.google.com/drive/api/v3/push

I am unable to figure out a way to verify my domain to set up notification channel. Is there any Salesforce api documentation i can refer to for this? Has anyone set this up and can assist with this?

  • 1
    For those of us (myself included) that aren't deeply familiar with the Google APIs, can you summarize what is required and what you're struggling to accomplish via an edit? – David Reed Dec 15 '19 at 18:46

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 https://somedomain.my.salesforce.com/services/apexrest/myWebHook where 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 instructions shown.

The user agent that performs file upload verification has the user agent token 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

Your options:

  1. 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.

  2. 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.

  • Thank you.This was exactly what I was looking for! I followed the instructions, created a site in salesforce and verified domain using the HTML meta-tag verification method. – Anisa Dec 16 '19 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.