Search code examples
google-places-apigoogle-places-autocomplete

Google Places Service findPlaceFromPhoneNumber not returning any results


I've built an interface where a prospect can type in their business name and the Places service uses AutoComplete getPlace method to get the business PlaceID. This works perfectly if the location has a published address.

However, if the business has no published address (just service areas), then AutoComplete can't find the business, so the fallback is findPlaceByQuery (sketchy at best because it defaults to locations with published addresses) and findPlaceFromPhoneNumber which apparently only works if the business has a published address.

The problem is that if you send a business phone number to the findPlaceFromPhoneNumber method, nothing shows up. Here's the code I'm using:

const service = new google.maps.places.PlacesService(document.createElement('div'));
service.findPlaceFromPhoneNumber({
    phoneNumber: '+19135550000',
    fields: ['ALL']
}, async(place, status) => {
    if(status === google.maps.places.PlacesServiceStatus.OK){
        console.log(place);
    } else {
        console.log('Error: no query results');
    }
});

Is there any way to get the PlaceID of a business that doesn't have an address listed?


Solution

  • Such places are not available via Places API, there's a feature request for this: