Skip to content

Email a Google Map using Google Maps Static API

This template can be used to configure UIP to retrieve a map image from the Google Maps Static API and use it within the body of an outgoing email.

For details about the mapping API refer their documentation website at the URL https://developers.google.com/maps/documentation/maps-static. This template is only a basic example of what can be done.

UIP Resources

The provided template utilizes the following UIP resources.

Adapters

  • Email Sender - used to send an email containing map image via SMTP server
  • HTTP Request - used to retrieve map image from Google Maps Static API

Global Properties

  • googlemapsapikey - API key for Google Maps Static API

Workflows

  • emailgooglemap - used to email a map retrieved from Google Maps

Triggers

  • emailgooglemap - used to email a map image retrieved from Google Maps

Prerequisites

  • Google Cloud Platform account with access to Google Maps Static API

Setup Google Cloud Platform Account

In order to use the Google Maps Static API you must first create a Google Cloud platform account. An account can be created for free, but the process does require you to provide a billing credit card as part of its verification process.

Google already has great documentation to guide you through the process of setting up your Google Cloud project and API keys.

Template

Right-Click Here and Save link as to download the UIP Import Configuration template file for this template.

Input Properties

The following properties must be configured in order to import the provided template successfully.

  • Google Maps Static API Key - API key configured for use with the Google Maps Static API
  • Email SMTP Server Address - address of the SMTP server used to send emails
  • Email SMTP Server Port - TCP port number to securely connect to the SMTP server
  • Email From Address - email address used in "From" field when sending emails
  • Email Sender Username - username used to authenticate with the SMTP server
  • Email Sender Password - password used to authenticate with the SMTP server
  • Enable - Controls if the adapters and triggers will be set to Enabled. (true|false)

Import Configuration Template

Refer to Templates > Import Configuration Template for more details about how to import the downloaded template file.

Triggering Workflow

The template uses an Advanced Webhook trigger which can be called using an http request tool such as Curl or Postman.

It expects to receive a JSON text body similar to following example.

{
    "emailto": "email.recipient@service.tld",
    "latitude": "32.9126739",
    "longitude": "-96.9995346",
    "maptype": "hybrid",
    "size": "640x640",
    "style": "feature:poi|visibility:on", 
    "zoom": "20"
}

The trigger and workflow in this template support the following request parameters.

  • emailto *required - the addresses that should be used in the "To" field for outgoing emails
  • latitude *required - the GPS latitude coordinate used for the center and marker pin of map image
  • longitude *required - the GPS longitude coordinate used for the center and marker pin of map image
  • maptype - the type Google Maps image (default: hybrid)
  • size - the size of Google Maps image (default: 640x640)
  • style - style customizations for Google Map (default: "feature:poi|visibility:off")
  • zoom - zoom level of Google Maps image (default: 16)