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™ Conversation 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 Conversation. 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 Conversation. 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 Conversation 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 Conversation. 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 Conversation 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 Conversation.
  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

IBM Day – Blockchain over Kubernetes and Kubernetes Upstream – Recap of RTP Kubernetes Meetup

Co-Author:
 Tong Li, @email4tong The Research Triangle Park (RTP), NC Kubernetes Meetup is a well-organized event and its members regularly meet every month. It has over 750 registered members. The meetup speakers are SMEs from various companies like Red Hat, IBM, Lenovo, Google and many local startups like CloudPerceptions. The last Kubernetes meetup for 2017...

Continue reading IBM Day – Blockchain over Kubernetes and Kubernetes Upstream – Recap of RTP Kubernetes Meetup

Newsletters: The Curious Developer’s Best Friend

The great thing about software development is that there is always something new to learn! The terrible thing about software development is that there is always something new to learn! Luckily, there are tons of wonderful people sharing their knowledge every week in helpful and entertaining newsletters … and unfortunately, it can be really easy...

Continue reading Newsletters: The Curious Developer’s Best Friend

Kubernetes Upstream Contribution – 5 Do’s and Don’t

There is a good amount of documentation material out there on the Kubernetes community website which every contributor should read. However, if you are a new or intermediate contributor, or thinking to start contributing to Kubernetes upstream, hopefully, this post will help you understand some of the lessons that I have learned. This post discusses...

Continue reading Kubernetes Upstream Contribution – 5 Do’s and Don’t

Related Links

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.