Announcing GitInfo - GitHub app for Google Assistant [Open Source]
Here’s how you can build your own Google Assistant App for GitHub! We’re open sourcing this and worry not, it’s legit cool stuff!
Subscribe to our awesome Newsletter.
Yes, you all read the title right. It’s possible to make a Google Assistant App for GitHub! As a developer, I’ve always wanted to know the number of bugs or issues in my repo very often - so I thought why not make an assistant app for the same?
For the implementation of this project, please go through the full code here - you can also clone it to get a better understanding.
First things first, prepare all the nuts and bolts as shown here for API.AI and Google Actions setup. We will be setting up our own node client using heroku in this project.
The working model:
Now from the list of repositories we can choose any to get some details and insights about it. So here we go,
It’ll always be great for the owner of the repo to see that “0 open issues” including mine. So we can try out description and some commit details as well.
It’s now very easy to get to know the number of stars available for the particular GitHub repository. Every developer would just love that Github star including me! ⭐️
I love Github so much! Who doesn’t?! I thought of different ways to make Github more easy to use. While initializing the thought process, I thought of utilizing the Github APIs to the fullest and build something new. Then I thought why not an assistant app? So think of this environment where you code something seriously but you want to know who made the latest commit you can just get it with your voice sounds! Cool and easy isn’t it? ☺️
Let’s now explore the approach.
First let’s initialize ApiAiApp object,
Then based on the intent’s action name that we defined in our API.AI console we can build this responseHandler() function.
Based on the intent all the events will be triggered.
For a good card based suggestions view, we can use this function where suggestions are passed as an array to the list function,
Here richResponse is a string that will be displayed as heading the above suggestions,
Then of course we should make two Github API calls - one for getting all the repositories available and one for getting details about a particular repo,
The JSON response is sent as call back and then we parse only the detail the user asked for which we track using the Intent that gets triggered.
Please refer to my Github repository for the complete code: Ramkishorevit/GitInfo-Git-for-Google-Assistant
Now (assuming) that you’ve referred to my github code let us now host it in heroku. It’s very simple - install heroku first to your system. Then follow this, Heroku NodeJS Setup
Then after its hosted, bang! We are done! Just paste your webhook url in your API.AI console so every time a request comes from the user to API.AI, it’s going to get the response from our node client or webhook and this will return the response based on the intents and entities we classified.
So that’s it folks let’s all build amazing products for Google Assistant. If you want to contribute to this project and take Git to a whole new level, then feel free to open issues and send pull requests ‘cause I’m very open to open source!
Just code and just Git! 😉