Store Locator Implementation

Introduction

Users will often ask or want to know the location of your store or business office closest to them. The Store Locator activity allows users to find a list of nearby locations conversationally using a location pin or typed address.

Store Location Flow

The store locator activity defines the following steps for the customers to have the nearby business information they are searching for.

  1. Ask for the user's location
  2. If successful, provide a list of locations
  3. If unsuccessful, allow the user to provide a different location or go back to the menu

Start by adding the Store Locator activity via the Add Activity button.

Flow Builder canvas
click to enlargeFlow Builder canvas
click to enlarge

Flow Builder canvas
click to enlarge

Expanding the Store Locator activity will display the internal steps. To expand, scroll over the Store Locator activity and select Expand activity.

Flow Builder canvas
click to enlargeFlow Builder canvas
click to enlarge

Flow Builder canvas
click to enlarge

The Store Locator activity defines three steps in order for the customers to have the nearby business information they are searching for.

  • Get address.
  • Stores found.
  • Stores not found.

Implementation

Templates in Flow Builder are available from the Activities dropdown in the main navigation panel.

Flow Builder canvas
click to enlargeFlow Builder canvas
click to enlarge

Flow Builder canvas
click to enlarge

Select the Store Locator template from the list of available templates to implement onto your workflow.

Flow Builder templates
click to enlargeFlow Builder templates
click to enlarge

Flow Builder templates
click to enlarge

Select Add to Workflow to add.

The Store Locator template will be displayed in the Flow Builder Flow section:

Flow Builder templates
click to enlargeFlow Builder templates
click to enlarge

Flow Builder templates
click to enlarge

  1. Ask location.

All of the heavy lifting is done in this step. The Flow asks the user for their location via WhatsApp location pin or by entering an address as text. There is some code that needs to be configured here by opening the code view after selecting the Get address step.

userLocation = Context.get("userMessage") -- gets and stores address information provided by the user

locationResults = Location.stores("ENTER YOUR BUSINESS NAME HERE", 1500, 'GOOGLE BUSINESS TYPE', userLocation)

if locationResults.success == true then
    Context.set("storesFound", locationResults.places) --save the result list in a context variable
    Workflow.branch(20) -- Do not change
else
    Workflow.branch(21) -- Do not change

There are two required variables to be set in this code block.

  • Your business name, e.g. 'Yalo'
  • Your business type as it is assigned for the Google Places API. Please see the Google Place Types documentation.
    There is a third variable, seen above as 1500, which is the radius - in meters - to search around the user's location.
  1. Stores found
    When the location search returns valid locations, a list of them is displayed to the user. You may want to update the text for the tone of voice but changes to this step of the activity are not generally required.

  2. Store not found
    When the location search fails, the user is given two basic options - to provide a new location or to go back to a menu. You may need to update the options, especially for the menu location.

When finished, save all changes by selecting the Publish button.

Requirements

  • Customer can determine the number of stores shown and the max distance from the end-user.
  • Customer must ensure their location info is up to date and accurate.
  • Customer must provide data tags for “Place Type” to filter locations in Google Maps.

What’s Next
Did this page help you?