How to add the Google Books API to SUSI AI
SUSI.AI is a Open Source personal assistant. You can also add new skills to SUSI easily. In this blog post I’m going to add Google’s Books API to SUSI as a skill. A complete tutorial on SUSI.AI skills is n the repository. Check out Tutorial Level 11: Call an external API here and you will understand how can we integrate an external API with SUSI AI.
To start adding book skills to SUSI.AI , first go to this URL http://dream.susi.ai/ > give a name in the text field and press OK.
Copy and paste above code to the newly opened etherpad.
Go to this url http://chat.susi.ai to test new skill.
Type “dream blogpost” on chat and press enter. Now we can use the skills we add to the etherpad.
To understand Google’s book API use this url.Your request url should be like this:
you should replace APIKey with your API key.
To get started you first need to get an API key.
Go to this url > click GET A KEY button which is in right top > and select “Create a new project”
Add name to a project and click “CREATE AND ENABLE API” button
Copy your API key and replace the API Key part of request URL.
Paste request url on your browser address bar and replace BOOKNAME part with “flower” and go to the URL. It will give this JSON.
We need to get the full name of books which is in items array to that we have to go through this hierarchy
items array >first item>volumeInfo >title
Go to the etherpad we made before and paste the following code.
is there any book called * ?
!console:did you mean "$title$" ? Here is a link to read more: $infoLink$
- In this code “path” : “$.items.volumeInfo”
- $ represents full JSON result.
- items for get first element
- .volumeInfo is to refer volumeInfo object
this line produce the output.
- $title$ this one is for refer the “title” part of data that comes from “path”
- $infoLink$ this one gives link to more details
Now go to the chat UI and type again “dream blogpost”. And after it shows “dreaming enabled” type in”is there any book called world war?”. It will result in the following.
This is a simple way to add any service to SUSI as a skill.
You must be logged in to post a comment.