User Inputs
How to use the Address block to autocomplete location inputs.
Collect structured address inputs with Google Maps Autocomplete, allowing users to search for locations easily in your chatbot agent.
The Address User Input Block enhances user experience by allowing users to autocomplete address inputs using the Google Maps API. This is particularly useful for agents that need structured location data such as street addresses, cities, or postal codes.
Key Features
- Required field: Ensures users provide a valid address before proceeding.
- Restrict to list only: When enabled it users con only select address suggested by Google Maps. Typing custom addresses will not be allowed and the block will prevent submission until a valid suggestion is selected.
- Placeholder Text: Customizable prompt to guide users (e.g., “Enter your address”).
- Button label: Customizable button text for the search action.
- Save answers in Variable: Save the selected address in your desired variable.
How It Works
- The block renders a text input powered by Google Places Autocomplete.
- As the user types, location suggestions appear.
- When the user selects a suggestion, the formatted address is saved in the specified variable.
Setup Instructions
1. Add the Address Input Block
- Drag and drop the Address input block into your flow.
- Configure the Prompt to ask users for their location (e.g., “Can you provide your address?“).
2. Google Maps API Key
- This block requires a valid Google Maps JavaScript API key. We provide a limietd number of free requests, but you will need to set up you own key for production use.
- Go to the Google Cloud Console to generate an API key.
- Ensure your key has the Places API enabled.
- Add your key to the environment or agent settings under Google Maps API Key.
Note: After changing your Google Maps API key, you need to wait for 5 minutes for the changes to take effect.
3. Save Address to a Variable
- Assign a variable name to store the selected address.
- This variable will contain the full address string returned by Google.
Example Configuration
- Prompt:
"Where should we send your delivery?"
- Variable:
user_address
Once selected, the variable user_address
will store something like:
"742 West Evergreen Street, Springfield, Misuri, EE. UU."
Use Cases
- Delivery address collection
- Event location input
- Property lookup
- Booking/reservation systems
Limitations
- Requires an active Google Maps API key.
- The accuracy and format of address results depend on Google’s database.
- Not suited for offline or custom location lists.