Ever thought Alexa as your Book Assistant

Mukul Jain
5 min readFeb 28, 2018

--

Last year, both Alexa and Google Assistance changed the AI and “voice first” game forever. With Amazon launching various echo devices and Google focusing on its smart home features, everyone was talking about AI and bots last year. So, it was obvious that 2018 was going to be the year, where voice-based apps invitations comes in front of everyone. Everyone is thinking of different ways to utilise and explore voice based technology. Last week I saw people making Alexa skill based games, at a meetup and some I’ve heard are integrating their IoT projects with Alexa. If you want to know how you can develop your first Alexa skill, here is my old post.

As the blog title suggests, the Alexa skill I will be discussing with you here, is a book related skill. I was working on this for last 2 months. Though, I am developing Alexa Skills for last 4–5 months now, and so far I’ve released 5 skills. But the best one I’ve made, is the one I’m going to discuss with you all in this post, BFI: Book Engine.

I’ve started this as part of Amazon’s kids skills challenge. I developed an Alexa Skill which can tell kids about books, which are aimed for only children. For this I used Goodreads shelf/labels, so if the books was labeled kids or children or something like that, I let the Alexa proceed and tell the information to user, otherwise I let them know, that the requested book is not for kids. Before submitting my skill for the hackathon, I published it on Alexa skill store. At the time of writing this post, this skill had 150 unique visitors. You can check my demo video for the hackathon in the links at the end of post.

After this, I was part of an amazing initiative by Paytm, ‘Paytm, Build For India’ Open Source Incubator. This is a program for those who want to build and fix problems of India, using open source technologies. There any multiple groups which are working on projects ranging from Blockchain to NLP. You can read this to know more about this initiative.

During this I extended my hackathon alexa skill into a full fledged project, which not only responds to any book or author request but can also tell which books are popular this week or all-time famous, based on genre. I also made sure that I use serverless architecture at its fullest, which I will discuss little more in one minute, stay tuned.

During this period I also got support of couple of contributors who were also part of this program. They helped in some features of the project. At this point, I also explored AWS Lex, which is an amazing service for creating chatbots. Now, if you’ve build an even simple Alexa Skill in past, you know that they invoke AWS Lambda Functions to handle intent and send the response back to Alexa in simple JSON format. Now, the best part here was, that Lex was also invoking Lambda functions on user requests, exactly like the Alexa Skill. So, Lex also handles intents using Lambda functions whenever user sends some message and sends an JSON response. So, basically both can have same business logic, Alexa skill and chatbot. Then, I did some optimisation and refactoring in code, and guess what, I had same module which was powering both Alexa Skill and chatbot. Isn’t it cool, that you have same code for running both your Alexa skill and Facebook chatbot, which removed the code duplicacy . As the project is open source, you can find all the source code on Github. Both Alexa and bot are made using Node.js (as both are invoking same code), and we have also used Python for backend tasks.

Coming back to serverless, the advantage Lambda functions gave me was that now my apps were 100% serverless. I don’t worry have to worry about server scaling and maintenance anymore.

Last month I released its MVP and gave a demo at a local meetup in New Delhi. There I got some amazing suggestions about it from audience, which helped me when I was working on its version 2. Now because of suggestions I got at meetup, I already had some new ideas in mind and this helped me in speeding up the development process and I released the next version in 3 weeks (it was quite fast for me, considering it was a side project and I was only giving 1 hour at max daily).

There are quite a few things you can ask this skill right now.

Tell me about Harry Potter by JK Rowlings
Who wrote The fault in our stars
Similar books like The Lord of the rings
Give me a short description of The Women on the Train
Most popular mystery books for this week
Most popular horror books for all time

You can see from above sample requests, that how an Alexa can act as so-called “book-assistant”. Assume, you’re about to start a book but before that you want to know little about it first, you can always google it. But why not, use Alexa to ask Book Engine about it. Or you loved a book and now you want to know about others books like it, well your personal book assistant got you covered there too. There are many more possible features I have in mind from getting famous books of some author, to getting best-seller list of books.

I also keep try to share this skill and chatbot, with my friends or colleagues and try to see how they respond with the skill or bot. From their request’s logs, I have learned a lot about possible user’s pattern, i.e, how they might want to talk to AI. As this is very important when you’re building some kind of AI bot, to design a conversation-flow, so that user can stay interested in talking with the AI. Otherwise there is no point of AI.

Links related to post:

Skill Demo video

Source code for Alexa skill and chatbot

Alexa Skill on Skill store

Well, that was it from me, talking about BFI: Book Engine and how I developed it. Do share if you’ve built some alexa skill or have some cool idea for it.

I hope you found this post useful and it gave you some innovative ideas for your own Alexa Skill. Please do let me know in case of any question or query. If you like this post, you can clap for it or follow me on Medium for my latest posts or on Twitter.

--

--