# Ask Location

{% embed url="<https://app.supademo.com/demo/cmma7syes7ialdtfh2s9ss5c6?utm_source=link>" %}

The **Ask Location** action allows the chatbot to collect the **user's geographical location** during a conversation.

This action prompts the user to share their location using the messaging platform's **location-sharing feature**. Once the user shares their location, the chatbot captures the **latitude and longitude coordinates** of the selected location.

The captured location data can be stored in a variable and used later in the chatbot workflow for delivery services, appointment scheduling, service availability checks, or location-based automation.

### **When to Use Ask Location**

Use the **Ask Location** action when the chatbot needs to collect the **user's physical location**.

**Common Use Cases**

* Delivery address verification
* Finding nearby service providers
* Location-based service availability
* Pickup or drop-off coordination
* Event check-in locations

Example interaction:

Bot: Please share your current location so we can continue with your request.\
\
User: 📍 Shares location

The chatbot then captures the coordinates of the shared location.

### **How to Add Ask Location**

Follow these steps to add the Ask Location action to your bot workflow.

* Open **Bot Builder**
* Click **Add Node**
* Select the **Ask** tab
* Choose **Ask Location**
* Configure the required fields
* Click **Create**

Once added, the chatbot pauses at this step until the user shares their location.

### **Ask Location Configuration**

When creating an Ask Location action, several configuration fields must be completed.

#### **Action Name**

The **Action Name** identifies the action inside the bot workflow.

This name is visible only within the bot builder.

Example:

Collect User Location\
Capture Delivery Location\
Get Customer Coordinates

The walkthrough example uses **"Collect User Location"** as the action name.

#### **Message**

The **Message** field contains the prompt shown to the user requesting their location.

Example:

Please share your current location so we can continue with your request.

This message instructs users to share their location using the messaging platform's location feature.

The message supports:

* Dynamic variables
* Text formatting
* Emojis

Variables can be inserted using the **Add Variable** option.

#### **Error Attempt**

The **Error Attempt** field defines the number of invalid attempts allowed.

Example:

Error Attempt: 3

If the user fails to share a valid location multiple times, the chatbot triggers the configured **Action on Invalid** behavior.

#### **Error Message**

The **Error Message** is displayed when the user provides an invalid response instead of sharing a location.

Example:

Please share a valid location to proceed.

This helps guide users to share their location correctly.

#### **Action on Invalid**

This setting determines how the chatbot responds when the maximum error attempts are exceeded.

Available options include:

**End the Flow**

Stops the chatbot conversation.

**Skip the Question**

Allows the chatbot to continue the workflow without collecting location data.

**Fall Back Flow**

Redirects the user to another predefined chatbot flow.

### **Store Response in Variable**

The **Store Response in Variable** option saves the captured location data.

Example variable:

user\_location

The walkthrough demonstrates creating a new variable named **User\_Location** to store the collected coordinates.

#### **Creating a New Variable**

If no suitable variable exists, follow these steps:

* Click **Create New Variable**.
* Enter the variable name.

Example:

User\_Location

* Select the variable in the **Store Response** field.
* Click **Create** to finalize the configuration.

### **Data Captured by Ask Location**

When the user shares their location, the chatbot captures:

* Latitude
* Longitude
* Map location reference

These coordinates allow the system to identify the user's exact geographic position.

#### **Example Ask Location Interaction**

Example chatbot conversation:

Bot: Please share your current location so we can continue with your request.\
\
User: 📍 Shares location

The chatbot stores the location coordinates in the variable:

User\_Location

and continues the workflow.

### **Best Practices**

Follow these recommendations when using Ask Location.

**Clearly explain why location is needed**

Users are more likely to share their location when they understand the purpose.

**Provide clear instructions**

Tell users to use the **location sharing option** in the chat.

**Handle invalid responses**

Use helpful error messages when users send incorrect input.

**Store location properly**

Save coordinates in variables for later processing.

**Use location data responsibly**

Ensure location data is used only for the intended service.

### **Summary**

The **Ask Location** action allows chatbots to collect **user location data through map-based sharing**.

With Ask Location, you can:

* Collect geographic coordinates from users
* Request location sharing through chat platforms
* Validate location input
* Store coordinates in variables
* Use location data for delivery, navigation, and service automation

This feature helps businesses provide **location-based services and improve operational efficiency through chatbot automation**.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ownchat.app/bot/ask-action/ask-location.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
