Forum Documentation Showcase Pricing Learn more

Help with Google Place IDs

Hi, I have a couple of questions about the Google Place ID. I am trying to use it by asking a user to input an address and have the following things happen:

a) As the user types the address, the input box shows an autocomplete address below that the user can select

b) When the address is submitted (I have a ‘Submit’ button’ that has a workflow that uses the various data to create a new thing - in this case a ‘Shop’) - it stores a Google Place ID in the database. I have a field under ‘Shop’ that is called Google Place, and I can access the API from there using the external API, but then when I try to pass the address into ‘Location’ and return a 'Google Place’s id) I get an error message. I must be using this incorrectly but can not find anything to help.

Any help appreciated!

Many thanks

Simon

What is the error message you’re getting?

Also, you should probably store the Google Place itself, not the id. The id won’t be very useful, while the place itself will contain the name, address, etc.

I am probably using the Google Places API incorrectly as I only just installed it. I can not find a reference for it specifically within Bubble (apart from the general reference for plugins) although I have looked around the Google Places website pages and found some information there

When installed, it is possible to set a Field (belonging to a Thing) as a ‘Google Place’ (instead of text, number, etc.). So I thought it would be interesting to record it as I input various Shops, Cafes, etc.

I have a workflow that creates a new thing (Shop) when a button is pressed. For the ‘Shop Google Place’ field I have referenced the ‘Get data from an external API’ Google Places’ option.

When ‘Get Google Places’ is selected it brings up another 4 options:
Query - not sure how to use this but I assume you use it to tell Google Places what you want returned. I have left it blank.
Location - I’m trying to use the address entered in the input box for this to send to Google Places
Radius - not used here (but I think would be used to send Google Place a distance from a starting location)
Type - not used here (but used to send a type of Place that Google Places returns)

Back in the ‘new Shop’ box, it shows as Shop GOogle Place = Get Google Places’s id (all in red as there is an error). The issue message is ‘Create a new Shop…: value should be a Google Place but right now it is a List of texts’

So it seems that I am not telling it to return just one result, and the result is coming as a text and not a Google Place.

This all relates to point b) in my original email. On a) is it possible to create an auto-complete function?

Thanks

Simon

So for the list of parameters for for the Google Places API, you should indeed look at the Google Documentation for this.

Your issue is that the Google Places API returns a list of places, and you want to store that in a field that isn’t a list, just a place. Think about it… What you want is not the id (because that means getting the id of each item of the list, which is a list of text). What you want is probably pick the “first item”. Then the type will be fine.

for b was is the issue? the search box is precisely an autocomplete element. Just pick geographic places as the type of choices.

OK I will try again - in the meantime can you tell me what are the possible values we can input into ‘Query’ and ‘Location’?

Many thanks

Simon

Here is is the list of the parameters google takes (this is not a bubble thing, it’s really a google places API question).

https://developers.google.com/places/webservice/search

If you search for “Text Search Requests” you’ll see the relevant section.