In this tutorial we’ll be looking into Api.ai, an API that lets us build apps which understand natural language, much like Siri. It can accept either text or speech as input, which it then parses and returns a JSON string that can be interpreted by the code that we write.
They start by explaining some of the concepts you'll need to know in using the service: agents, entities, intents, contexts, aliases and domains (each with a summary and examples). In their example, they show how to get the current time from any given places using their API. He shows you how to set up a free account and create a new agent. He then uses Guzzle (the HTTP client library) to make the request to the API with your API and subscription keys. They show the result of a query for "What's the current time in Barcelona Spain?" and how to extract the "location" value from the results. With this they then search the Google API for the local time of "Barcelona Spain". With the time in hand, they then use the responsive-voice.js library to convert the text to speech at the click of a button.
With all these concepts under your belt, they also walk you through a second application, a currency converter. It uses the same workflow as the previous example with the exception of using the CurrencyLayer.com API to perform the financial conversion. All code needed for this example is included as well. If you'd like to just jump to the end, they've also shared the complete code for both examples over on Github.