I travel a lot and there are times that I don't have internet access when I need it the most, like when in train, etc. I always wondered it would be great if there was a service that could tell me about something, get nearby business address and phone number and monitor my computer for me, like get server stats, turn lights on or off, and when I learned about the Nexmo APIs a few days ago, it was like a dream come true.
What it does
Nowadays when everyone is connected to internet 24x7, we are so much addicted to it that we feel sad when we cannot access it, well no more now. It is a service/application that listens to SMS from users, and returns the first paragraph on Wikipedia about it, or details of UPTO 3 places on Google Maps(Including phone, address and rating etc), or if thats not enough for someone, save it for our computer to poll depending on your query, you can get an sms or voice response depending on what you asked.
- For it to search on wikipedia, there must be a page on wikipedia with the same name like - 'Albert Einstein'
- For it to search for a place on google maps, put your search term then 'near' and then where you are like - 'dominos near okhla phase 3 delhi'
- For it to send it to your computer, you must have a script running on your computer that polls from server and sends back response, the link to the script is in the 'Try it' section, feel free to modify the script to our needs as long as it calls my offline-helper api correcty. One must prefix 'automate ' to the query. like - 'automate monitor off'
- By default it calls you with a response, but if you want to get sms prefix it with 'sms', like - 'sms Amitabh Bachchan'
The main attraction is the automate feature, which can be extended to lots of things, like server monitoring, pc control, or even Home automation like turning lights, air conditioning on/off remotely, you just need to configure some commands. Also since it is in python, it can run in any environment with a python binary, windows, linux, mac, and even android. There are many more applications of this, like creating text alert on heating by connecting it to a temperature sensor, or patient sms alert for doctors, by connecting it to a machine on patient.
This project has automation, combines many APIs, like (various Google ones, Wikipedia, Nexmo etc), and is so fun to use that everyone wants to try it at-least once.
How I built it
I built it using the Nexmo API, I get a callback whenever someones send an sms to the Nexmo provided number. I then parse the query in python, use the Wikipedia API, or the Google Places (by geocoding the address and searcing place near that coordinates, and then getting the place details by placeIds), or your computer. If its asking for an sms reply send an sms using the nexmo sms API or else send a call using the voicemail api and nexmo-tts. If the message is prefixed with 'automate', it saves the query in a database. Then there's another API for the devices to poll, it takes the phone number as request and gives back the command. Then theres one to send reply, which removes the command entry from the database, and sends the reply to the phone, sms or call depending on the reply string.
Challenges I ran into
The main problem that I faced was getting the automate pc to work, but finally made it work.
Accomplishments that I'm proud of
Finally getting a seamless working service to work, in just a few days time, when I got to know about the hackathon.
What I learned
Well, A LOT (and not just coding):
- Nexmo APIs
- India DND system
- Albert Einstein (check my demo to get it.)
What's next for Offline Helper
- Making a website for this, with a step by step guide on how to use this.
- Integrate more APIs other than Wikipedia, like Wolfram Alpha
- Implementing a Hindi(my mother tongue) version of it.
- Improving the automation script, and making a GUI for it.
- Some more...
- Nexmo Number - +91 922 322 1416
For those not in India and cannot send an sms to that number
- Nexmo SMS callback URL - <PM me for this, removed to avoid abuse/spam>
- Testing URL, simulate an SMS on this to get the output returned as raw text, instead of going to your phone. -
- Please DON'T spam.
- Automation polling script - https://gist.github.com/PalashBansal96/1ded8c206530a951e429
Just download the script and run with python.
(Prefix reply with 'sms' to send an sms respond).
- Note: In India those who have DND enabled(like me), you cannot get an SMS, sorry.