Twitter Bot for the awesome Public Transit Directions Assistant - https://lara.ng
This project doesn't try to reinvent the wheel, instead, wraps an existing solution (lara.ng) to provide public transit directions to Twiitter users.
I've been using lara.ng for a little over 2years but recently followed them on Twitter and I tried to do this (thinking I would get a reply) 👇 That was when it struck me! There are millions of Nigerians on Twitter, why not make this accessible to them. Afterall, Lara claims to be a (chat) bot.
If you didn't know already, there is no public API to interface with lara.ng. To have access, you need to submit a request to hello@lara.ng. Never tried that before so I can't say how easy/painful the process is.
No API? No Problem! Puppeteer to the rescue!
With puppeteer, I was able to crawl lara.ng, make a request on behalf of the user, intercept its response, parse and send directions to their DM.
- A user tweets @lara_dotng e.g.
@lara_dotng from takwa bay to maryland
- Take the destination query i.e.
from takwa bay to maryland
- Crawl lara.ng
- submit the query
- intercept & parse the json response
- send parsed response to (Twitter) user DM
- notify user to check their DM
This project is licensed under MIT