On My Way: An ArcGIS and Twilio Mashup

1212
1
05-04-2015 02:02 PM
JamesMilner1
Occasional Contributor
0 1 1,212

For a long while I've been wanting to make an app that implements both the Twilio and ArcGIS APIs. Thankfully I've had a little more time recently and over the past couple weeks I have been working on On My Way. On My Way is a basic web application that highlights the powers of the ArcGIS Routing REST API and the Twilio SMS API. If you haven't tried it yet, the routing API allows you to route between two given locations as a service. It has a host of parameters to try out including method of transport (Walking, Driving, Trucking), directions and barriers (places you don't want to route through). The Twilio SMS API provides developers a simple interface for the sending of texts (SMSs) to numbers of their choosing, and also has a selection of helper libraries in various languages.. You can check out Twilio' s website​ for more information on their services.

OK cool, what does it do?

A basic outline of the functionality of 'On My Way' is as follows:

  1. User A inputs a friends Postcode (ZIP Number?!)  and friends mobile number. The user then selects if they are driving or walking.
  2. User A is then presented with a screen informing them there friend has been texted with their mode of transport and how long it will take them. They are also given a map demonstrating the suggested route
  3. User B is delivered a text with this information.

How was it Implemented?

Front End

The front end made use of some of some really nice input effects (built by Codrops; see here for GitHub repo and here for the article). I went with the 'Yoko' style which gives this cool 'popup'-like user input with the label text underneath. The app also made use of some Google Fonts; Pacifico font for the title and Raleway for the input labels / main text. The background image was a open image from unsplash.com

Once User A has submitted the details (User Bs phone number and Postcode) they receive a map with the suggested route to User B on. The map takes the route JSON passed back from the REST request made in the PHP script via AJAX.

Back End

The back end used PHP (Boo, hiss), making ArcGIS REST requests using cURL and outputting the results to both an SMS via Twilio and back to the client using AJAX. The Twilio SMS API was very easily implemented using their PHP SKD. ​I imagine it would be a similar task to implement the functionality in other languages such as Python or Ruby.

Can I have a play?

.

I've open source the project and left it on my GItHub account for everyone to have a tinker with if they so wish. You can find the link here. You can also see a live demo here.

1 Comment
About the Author
Esri UK developer evangelist. Fan of maps, coffee, 3D, hot sauce, coding, web, Android, drawing, PC gaming.