Build Out a Lita Skill to Take in Messages from Alexa

Alexa is sending you the JSON payload you need to push a user’s dictated message into Lita’s Redis storage. Here’s a step-by-step plan to make it work:

  • Tell Lita to listen for POSTs on a specific URL route.
  • Route those posts to a method that parses the JSON as a Ruby hashmap.
  • Extract the message you want from the hashmap.
  • Pass that message on to another Lita handler using a named trigger.
  • Acknowledge receipt of the message back to Alexa.

If you get stuck in implementing this Lita handler, check out my finished code on GitHub.[61] It includes all of the methods and tests described in this chapter.

Tell Lita to listen for POSTs on a specific URL route

Listening for a POST on a specific URL is a ...

Get Build Chatbot Interactions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.