Map

  • A static Google Maps component
  • Plots a pin on the map based on coordinates
  • Requires a Google API key to be based into ServisBOT Messenger in the ServisBOT.init() function

We automatically provide a key for our testing and preview pages, but you will need to generate and maintain one when deploying your bot to production. You can obtain a key here: Google Maps API Key

The parameters for StaticMap are:

Name Type Default Values Description
description string - - the description to be associated with the map e.g. the address
lat string - - the latitude co-ordinate of the pin to place on the map
lng string - - the longitude co-ordinate of the pin to place on the map
googleApiKey string - - Optional field, if no key is provided in the ServisBOT config, a key can be provided in the timeline element

An example of StaticMap markup is:

<TimelineMessage>
  <StaticMap
    description="Heres the Aviva stadium"
    lat="53.335309"
    lng="-6.228413"
  />
</TimelineMessage>

Get Users Location Using a Map

The map timeline element can be used to request a users’s location simply by using it with the markup interaction node and adjusting the markup.

<TimelineMessage>
  <StaticMap
    title="Please confirm your location"
    interactionType="event"
  />
</TimelineMessage>

The results will be provided as part of msg.payload.markupInteraction.

"markupInteraction": {
  "lat": 42.34339322495768,
  "lng": -71.09655591550987
}