Bots often need the user to input a location to complete a task. For example, a Taxi bot requires the user’s pickup and destination addresses before requesting a ride. Similarly, a Pizza bot must know the user’s delivery address to submit the order, and so on. Normally, bot developers need to use a combination of location or place APIs, and have their bots engage in a multi-turn dialog with users to get their desired location and subsequently validate it. The development steps are usually complicated and error-prone.
As announced on the Bot Framework blog, the open source Bing Location Control for Bot Framework allows bot developers to easily and reliably get the user’s desired location within a conversation. The control is available in C# and Node.js and works consistently across all messaging channels supported by Bot Framework. All this with a few lines of code. Key features include:
- Address look up and validation using Bing Maps REST services.
- User location returned as strongly-typed object complying with schema.org.
- Address disambiguation when more than one address is found.
- Support for declaring required location fields.
- Support for FB Messenger’s location picker GUI dialog.
- Fully-customizable and localizable dialog strings
Follow the detailed guidelines on the coding steps to add the Bing Location Control to your bot. You can also find the full developer guides and sample bots for C# and Node.js in the BotBuilder-Location github repository.
Below are a few examples that show different location selection scenarios supported by the Bing Location Control.
1. Address selection with single result returned
2. Address selection with multiple results returned
3. Address selection with required fields filling
4. Address selection using FB Messenger’s location picker GUI dialog
We’d like to hear your feedback and comments on our efforts to make it easier to build smart bots. You can reach out to us on StackOverflow with the hashtag #botframework or comment on Bing Listens.