{"section":"tutorials","requestedLocale":"en","requestedSlug":"using-expressions-to-capture-the-users-location","locale":"en","slug":"using-expressions-to-capture-the-users-location","path":"docs/en/tutorials/weni-by-vtex/flows/using-expressions-to-capture-the-users-location.md","branch":"main","content":"In this article we will see a practical example of how using expressions and variables can be useful for your chatbot. Here, we will focus on a very simple example, but also can be very useful for everyone: **Being able to capture the user 's location by the conversation, and can use this data later.**\n\n## Step one: Identify the channel\n\nHow to capture the location changes depending on the channel you are using on the platform.\n\n### Web channel\n\nTo capture a user's location via the web channel, simply create a \"\"Send Message\"\" action letter with a \"\"Quick Reply\"\" with the prefix \"\"[Loc]\"\", so the user can reach that button, we can capture the location via browser. After that, simply save the result in the \"\"Wait for response\"\" decision letter.\n\n![](https://cdn.statically.io/gh/vtexdocs/help-center-content/refs/heads/main/docs/en/tutorials/weni-by-vtex/flows/using-expressions-to-capture-the-users-location_1.png)\n\nThe message received by the web channel will always begin with: \"\"My Location is:\"\", followed by the user's latitude and longitude in the format \"\"[latitude, longitude]\"\". To remove these prefixes, simply use the expression @(replace) and then separate the latitude and longitude values into different variables, using the @(split) expression to separate using the comma (\"\",\"\") that separate them as a parameter.\n\n![](https://cdn.statically.io/gh/vtexdocs/help-center-content/refs/heads/main/docs/en/tutorials/weni-by-vtex/flows/using-expressions-to-capture-the-users-location_2.png)\n\n### Telegram channel\n\nTo send the location via telegram, the user needs to click the button 📎, select \"\"Location\"\" and then \"\"Send my current location\"\".\n\nWith this, simply create a \"\"Wait for response\"\" decision letter and save the value. The telegram sends the location in the format \"\"latitude, longitude\"\", not needing to do the process of using @(replace) to remove texts, only separate using split as in the web channel.\n\n![](https://cdn.statically.io/gh/vtexdocs/help-center-content/refs/heads/main/docs/en/tutorials/weni-by-vtex/flows/using-expressions-to-capture-the-users-location_3.png)\n\n### WhatsApp channel\n\nTo send the location via WhatsApp, the user needs to click the 📎 button or ➕ the, select \"\"Location\"\" and then \"\"Fixed location\"\".\n\nUnlike other channels, the location via WhatsApp does not come as text, but as an attachment, so we need to access it using the variable: @input.attachments.0\n\nThis variable is the location in the format \"\"geo: latitude, longitude\"\", so we need to use the expression @(replace) to remove the \"\"geo:\"\" and then use @(split) to separate latitude and longitude like the other channels.\n\n![](https://cdn.statically.io/gh/vtexdocs/help-center-content/refs/heads/main/docs/en/tutorials/weni-by-vtex/flows/using-expressions-to-capture-the-users-location_4.png)\n\nThis way, we are able to create a flow with support to capture the user's location across three different channels, using the expressions and variables available on the platform.\","}