For few use cases like delivering a Pizza, it would be a great user experience to take user’s current location directly from a Map instead of asking the user to type his address.In this post, we will see how to capture the user location from a map in a chatbot developed in Oracle ChatBots.
Oracle bots provide a component “System.CommonResponse” which helps us here to get the location. Below is the snippet to get the location.
– type: “text”
text: “OK.. Please provide your address to deliver the Pizza?”
– label: “Send Location”
The above code results as below image.
The JSON contains, latitude, longitude, title of the location on the map and the direct url to the selected location.
In the above example we have another action “textReceived” which helps to handle if user inputs text instead of selection on map.
Note: While implementing this, please check if your client application supports this feature and maps. I tested this with FB and Test console.