Create an Alexa skill with serverless and a conversation  

Use Alexa and Watson to discuss the weather, build a conversation, or choose one from a library

Last updated | By Niklas Heidloff, Mark Sturdevant

Description

In this developer journey, we will create an Alexa skill using Watson™ Assistant via the Apache OpenWhisk serverless framework. Alexa is the voice service behind products like Amazon Echo. IBM Cloud Functions (based on Apache OpenWhisk) will be used to integrate Alexa with Watson Assistant. An example conversation is included to demonstrate how to pass context between different intents. You can also use this journey to try out a conversation from the Bot Asset Exchange (BAE).

Overview

Leveraging multiple technologies is common in many workflows, and this developer journey was created to show how you can integrate an Amazon Alexa skill with Watson Assistant. If you’re a developer focused on chatbots or artificial intelligence, this is for you. This journey shows you how to take a conversation built with Watson and make it available to Alexa users.

We will create an Alexa skill using Watson Assistant via the Apache OpenWhisk serverless framework. Alexa is the voice service behind products like the Amazon Echo. IBM Cloud Functions (based on Apache OpenWhisk) will be used to integrate Alexa with Watson Assistant. An example conversation is included to demonstrate how to pass context between different intents, resulting in a weather lookup. You can also use this journey to try out a conversation from the Bot Asset Exchange (BAE).

We wanted our conversation to remember the conversation state and be able to request external actions, so we chose Redis to save the state across invocations of our serverless functions, and we built an external action that retrieves the weather forecast. You can extend this to use any Watson Assistant and add your own action code.

When you complete this journey, you will understand how to:

  • Create an OpenWhisk action in the IBM Cloud Functions serverless platform.
  • Use Redis to store a session’s conversation context across events.
  • Import a conversation from the BAE or a JSON file.
  • Invoke a conversation with Watson using Node.js.
  • Use The Weather Channel data service to look up locations and forecasts.
  • Create an Alexa skill to reach tens of millions of customers.

Flow

  1. User says “Alexa, ask Watson…”.
  2. Alexa invokes IBM Cloud Functions with input text.
  3. The action gets the conversation context from Redis (if any).
  4. The action gets a response from Watson Assistant.
  5. The Weather Company data service provides the forecast (when applicable).
  6. The response context is stored in Redis.
  7. The response text is sent back to Alexa.
  8. Alexa replies to the user.

Related Blogs

Jax 2018 – Just An Awesome Experience

What a week! From 23rd to 27th April our Berlin team attended the Jax conference in Mainz, Germany. We had such a great time sharing our fresh perspectives, in the form of a rousing keynote and two informative sessions. The concept of this annual event with over 2,000 participants, revolves around innovating with Java, architecture,...

Continue reading Jax 2018 – Just An Awesome Experience

CloudNativeCon and KubeCon are coming to Copenhagen!

With May just around the corner, mark your calendars for an exciting event, CloudNativeCon/KubeCon, in Denmark’s capital city of Copenhagen. Many of us in the Cloud Native community already visited this beautiful city for DockerCon EU last year and we’re excited to be able to take in all of the wonderful sites again this year....

Continue reading CloudNativeCon and KubeCon are coming to Copenhagen!

Live analytics with an event store fed from Java and analyzed in Jupyter Notebook

Event-driven analytics requires a data management system that can scale to allow a high rate of incoming events while optimizing to allow immediate analytics. IBM Db2 Event Store extends Apache Spark to provide accelerated queries and lightning fast inserts. This code pattern is a simple introduction to get you started with event-driven analytics. You can...

Continue reading Live analytics with an event store fed from Java and analyzed in Jupyter Notebook

Related Links

Architecture center

Learn how this code pattern fits into the Cognitive Conversation Reference Architecture

Award winners

Amazon Alexa and IBM Watson won the 2016 Voice Assistant Wars.

Bluemix Stirred

Learn how to use the Amazon Echo and Dot with the Watson Conversation Service.