# Request User Location

The WhatsApp Location Request function allows you to request a user's location through WhatsApp. This function creates an interactive message with a location request button that prompts the user to share their current location.

#### **Implementation**

To use this function in your Voiceflow project:

1. Upload the custom function downloaded from the Custom Functions page on your FlowBridge environment, to your Voiceflow project as a custom function.
2. Add a Custom Function block in your Voiceflow flow.
3. Select the uploaded WhatsApp location request function.
4. Configure the input variables

#### **Input Parameters**

The function accepts the following input parameter:

* `bodyText`: The message to display when requesting the location (e.g., "Please share your location to find nearby stores")

If no bodyText is provided, a default message "Please share your location" will be used.

#### **Accessing Location Data**

When a user responds with their location, the following variables will be available in your Voiceflow project:

* `location_address`: The address of the shared location (if available)
* `location_latitude`: The latitude coordinate
* `location_longitude`: The longitude coordinate
* `location_name`: The name of the location (if available)
* `location_url`: A URL to the location (if available)

Once location data is received, we will also automatically send a message as text to Voiceflow which contains a stringified JSON object of the location data. This is done so that you can use a capture step to wait for the reponse, and continue after.

#### **Example**

<figure><img src="https://873142713-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9qvWi43l9ivADiJhqOPC%2Fuploads%2FnlpVhFcLgCdlblLPJRA5%2Fimage.png?alt=media&#x26;token=09cb24f8-9adf-4d72-b454-d6c51a356fbe" alt=""><figcaption></figcaption></figure>

![image.png](attachment:e096a75f-3763-4200-9a11-748ed7ebcc13:image.png)

![image.png](attachment:12ee5e7d-b425-44b7-b2de-882146f9f853:image.png)
