New Geocoding Features

Geocoding Features

Alexa: Check out Salesforce’s New Geocoding Features

A few weeks ago, I was at my brother-in-law’s house checking out their Amazon Echo.  The kids were having a blast playing tunes and adding items to the shopping list.  Okay, maybe it wasn’t just the kids. I picked up an Echo and began tinkering with Alexa, Echo’s version of Siri.

Alexa comes with a standard set of  “skills” you can interact with.  The skills are kicked off by asking Alexa a question, such as “Alexa did the Twins lose yet again?” or “Alexa, did Blair Walsh miss another field goal?” In addition, Amazon provides a developer account and portal for creating custom skills.  Enter Salesforce’s new automatic geocoding feature.

One of my favorite features of the Summer release is the ability to automatically geocode standard Account, Contact, and Lead fields.  All in all, you can run a clean rule to automatically set latitude and longitude for four different standard addresses.  If you’re interested in learning more on the geocoding feature, see the following article on the release notes here:

Side Note:  If you need to set custom addresses or automatically geocode custom latitude and longitude coordinates, consider running a trigger or process on a mock/dummy Account, Lead, or Contact and then carry over the coordinates to custom latitude and longitude fields.

Here’s where the light bulb went off.  Wouldn’t it be cool (maybe it’s just me) if you could ask Alexa when exactly you had to leave by, to make your next meeting on time?  Well, now you can with a custom Alexa skill, that queries for your next event/meeting in Salesforce, and then uses the Google Maps Distance Matrix API ( to calculate the travel time.

Here’s how it works:

  1. The automatic geocoding cleaning rule is enabled for accounts.
  2. An account is created with a MailingAddress specified.  When the account is saved, the latitude and longitude are automatically populated.
  3. An event of type “Meeting” is assigned to you, and also relates to the account created in Step 2.
  4. You call an “utterance” by saying “Alexa: connect to Salesforce”.
  5. After Alexa responds with “Connected to Salesforce,” you issue a secondary utterance “Get Next Event”.
  6. This calls a node.js service hosted on Heroku.
  7. Heroku uses the nForce toolkit to call a custom Apex REST service in Heroku, which responds with your next event, including the latitude and longitude of the account associated with the event.
  8. The node.js service then calls the Google Maps Distance Matrix API with the latitude and longitude, and calculates the travel time.
  9. The node.js service then returns the information via the callback URL set when setting up the skill in your Amazon / Alexa developer account.

Looking to implement your own custom Salesforce Alexa skill? You’ll need the following:

In order to implement the custom skill, I followed the excellent “Echo Case Control” tutorial from Salesforce Developer evangelist Josh Birk (@joshbirk on twitter):  Combining this with the node-googlemaps project (, I now had the following app:

After pushing the app to heroku, I could now ask Alexa to connect to Salesforce and get my next event:

Have an idea for your own Salesforce and Alexa skill?  Feel free to fork my project (or Josh’s project) above and tinker away.

Contact Us Now!

Looking for a trusted Salesforce Partner to help you get results? You’re in the right place! We would love to hear from you!

Contact Us

Facebooktwitterredditpinterestlinkedinby feather

No Comment

Comments are closed.

You may also like