Location
With Location steps, DRUID enables you to bring the real world to your users with maps by rendering a geographical location similar to Google Maps preview and configure your bots to get and store user’s geographical location shared in the chat.
Use cases
- Collect location data from your users (with Location flow steps) and use it to present location-aware messages that are more likely to convert them into leads. E.g. share location of a shop, business, etc.
- Assist users with instant location of a place rendered similar to Google Maps preview.
Adding and configuring Location steps
To add and configure a Location step in a DRUID flow:
- Open the desired flow in Flow Diagram view.
- Expand the Flow Palette, then drag the Location step from the Dialog category into the main flow window and drop it onto the step you want to link it to.
- Select the step on the diagram, then click the Settings icon from the Actions menu.
-
Configure the Location step according to your objective: either to capture and store the user's location or to share a specific location with the user in the chat.
Capturing and storing the user's location
To store the user's location shared in the chat, configure the Location step as follows:
Parameter | Description |
---|---|
Step name | The name of the step that is used by the system. It is not visible to the end user, but is useful for the bot author to document the dialog and later understand reports in conversation analytics. |
Step message | The message which will be displayed to the user in the chat. |
Input mapping (to receive user's location) | By default, DRUID stores the user's location in the system entity [[GeoLocation]]. If you want to store the location in another entity field, first make sure that you have an entity field of type Entity referencing the [[GeoLocation]] system entity, then on the Location flow step enter that field in Input mapping (to receive user's location) in the following format [[<Entity>]].<Field>. |
When the step is executed, the chatbot will return the message specified in the Step message field, wait for the user to share the geographical location and store that location in the entity provided in the Input mapping (to receive user's location) field (if any) or in the [[GeoLocation]] system entity (if you want to store it in DRUID default system entity).
Sharing a specific location with the user in the chat
To share a geographical location with the user in the chat, configure the Location step as follows:
Parameter | Description |
---|---|
Step name | The name of the step that is used by the system. It is not visible to the end user, but is useful for the bot author to document the dialog and later understand reports in conversation analytics. |
Step message | The message which will be displayed to the user in the chat. |
Input mapping (to receive user's location) | Make sure that this field is empty. |
Attachment (to send location to user) | Enter the entity that stores locations as best suits your needs, in the following format [[<Entity>]].<Field>. Your entity should have an entity field of type Entity referencing the [[GeoLocation]] system entity. |
Example: Sharing location based on user’s input address
User says: “Give me the location of Opera Center, Strada Costache Negri 1-5”
Chatbot replies “Here it is” and shares the place location in Google Maps preview.
In this example:
- We created a REST connector to integrate with the a Maps API that retrieves location in [[Place]].Location based on [[Place]].Address that stores user input address.
- [[Place]].Location is of type Entity referencing the [[GeoLocation]] system entity.
- The flow dedicated to sharing locations has one or more utterances that contain [[Place]].Address that will store user input address.
To share a geographical location with the users in the chat in Google map preview on a flow step of type Location, make sure that Input mapping (to receive user's location) is empty and in the Attachment (to send location to user) field enter [[GeoLocation]] or an entity field related to [[GeoLocation]] (in our example, [[Place]].Location ).
On the location step, in the PreAction section, also add an integration which interrogates the Google Maps API and receives the location attributes (GPS latitude, longitude, name, address)
Whenever the dialog reaches the Location flow step, the bot takes the address provided by the user and queries the Google Maps API, which returns the geolocation of the place located at the specified address. The bot renders the location in the chat similar to the Google maps preview.