That’s when it struck me: we have a field services app for field service technicians that I could turn into something mind-blowing.
Isn’t it funny how sometimes we are looking for the next big thing, for the challenge that will push us forward, for the little spark that will ignite our idea’s takeoff and it’s really close by, yet we didn’t have a clue?
I bet you’re thinking it’s figurative, but I really mean it. My spark was sitting really close. I work with Cristiana—or, as I now call her, Sparky—for the same company. So, when I stumbled upon her post about integration with Alexa, it was truly a wake-up call!
Is There an Echo in Here?
Ever since I bought my own Amazon Echo and set it up in my living room, I had been thinking about doing voice integration with Alexa. When I read Cristiana’s first tutorial on how to set up an Alexa skill, I knew I had everything I needed to create my own project. Particularly because it mentioned setting a REST endpoint, which is extremely easy with our development tool.
The hardest part was deciding what to actually do with it. I’d come up with some ideas, and while some were just more interesting than others, all of them lacked real purpose, you know? They were just empty technical demonstrations or integration showcases. None of them were truly useful for someone’s daily life.
And that, my friends, is why they’re called proof of concept apps. They’re cool technical demos, but that’s about it.
There’s a Field Services App for That
As luck would have it, there was another person in the company working on an app that we use to showcase offline patterns and native device integration. That’s when it struck me: we have a field services app for technicians that I could turn into something mind-blowing.
That’s a very special use case right there. Most of those technicians spend the day in the field behind the wheel. Wouldn’t it be awesome if they had a companion that browsed through their orders on command to get more information while they were driving to a customer’s house?
So, it was settled. Now all I had to do was see if could follow Cristiana’s instructions and get this thing running.
Time to Put the Good Old Dev Chops to the Test
First step: create an Amazon skill. A small step for a developer. That was the birth of my Field Services Skill. A simple phrase would trigger Alexa’s response: “Alexa, ask field services…”
Easy peasy. But for some reason, something told me to put some more thought into it. Sometimes we tend to rush to a solution instead of taking time to completely understand the task at hand. The technical integration is possible and quite simple—I won’t go there, as Cristiana is publishing an article on that very soon — but what questions would actually make sense, for a field services app?
So, if you’re behind the wheel, getting ready for your next assignment on the road, what questions are you most likely to want answered? That’s how I came up with 4 queries mapped to a corresponding intent:
- How many orders do I have? (CountOrdersIntent)
- What are my order’s details? (NextOrderIntent)
- Does the order have any additional notes? (OrderNotesIntent)
- Is the customer happy? (RatingIntent)
So, all I had to do then was define the utterances—what you actually say (utter) that Alexa will recognize.
I kept my utterances as simple as possible for my first try. I was aware that they would eventually have to become more complex because, in natural language, there are a lot of ways to ask for the same thing. But that’s a tale for a later date. For now, we’ll stick to simplicity.
Getting to the Endpoint
After this quick setup, I had to create the endpoint that would receive the messages from Alexa based on the four questions. Implementing the logic wasn’t too hard, since I already had a running field services app. All that was missing was a way to get the intent and the message attributes from Alexa, querying the database, and building an appropriate response.
In the visual IDE of the development tool I use, which is developed by my company—OutSystems—there’s a tab that shows the logic that you’re trying to implement. The succession of actions looks pretty much like this:
With this logic set and in motion—and with the help of Amazon’s Developer Console— testing was a breeze.
Amazon Developer Console has a great feature that allows you to simulate your request and show the message received from your endpoint. Therefore, I was able to speed up the development and testing because it is really easy to understand what’s going on under the hood.
Do you remember that feeling you got when you were kids, building something with blocks and then, right after finishing, you’d think: “Well, this is cool and all, but you know what would be really, really awesome?”
That’s just what happened to me. I was excited but still not completely satisfied with what I had built for the field services app. I wanted to go a little further. I wanted to ask Alexa about the “next order” and have her reply in context. And, that word there is key.
The term for this functionality is “context attributes.” When you trigger an exchange “session” with Alexa, you can use these attributes to get contextual information from her. Your next request will make use of this notion of “session.”
So, whenever Alexa receives a request to process an order detail, her response will have an index number that corresponds to that order detail. With this information you also know the index number of the following order.
Therefore, if you ask for the “Next Order” and your last order’s response is order #1, you will get the details for the next order in line: index number 2.
After I finished my development and testing, I created this video. In less than a minute, you can see how a small sample has huge potential:
Go Forth and Innovate
They say that there are two ways to innovate: one is through disruption; the other is by gathering and combining existing tools and skills, to create something completely new.
I believe you already have the necessary tools and skills, so what are you waiting for? Go build something new! Meanwhile, Alexa and I will play the field services app.