One of the major themes recently in Network Engineering, and IT as a whole, is the pressure to learn coding as an engineer. I do see this as a valuable skill, something to use to differentiate yourself, but on the whole enterprise IT isn’t going to see the value for at least 5 but more likely 10 years.
Ranting aside, I have been playing more recently with NodeJS to rewrite something I’ve written in python. Why? It gives me a chance to see how an algorithm (which is what true programming is all about) is able to be transitioned between languages. In this series I’m going to detail how I accomplished this.
I’ve chosen to start to refresh my coding journey by having a little fun with Cisco Spark, specifically writing a Bot that will post animated gifs in response to direct questions.
Please note, I’m not going to touch on how Spark works, this is detailed very well in the link to their developer documentation. This series will detail what I did to get everything working, the only pre-requisite is that you have already registered your Cisco Spark Bot, which is detailed in the developer documentation.
The first step in this is planning. Like all good engineering projects, a little planning up front will save headaches down the road.
Below is a list of steps I plan to take in this series.
- First, I will discuss webhooks and register one.
- Second, I will setup an NGINX reverse-proxy server to handle the incoming webhook.
- Third, I will detail getting NodeJS to listen for incoming requests, and handle them.
- Fourth, I will detail using the Spark API to grab the detail of an incoming Message
- Fifth, I will detail how to use the ImgUr API and NodeJS to search for and extract the path to an animated gif
- Sixth, I will detail posting the new image using the Spark API, responding to either a direct message or the chat room/space it came from
- Seventh and last, I will detail how to add a history function to your script, allowing the bot to take commands so it can delete old messages (useful in case something NSFW slips through)
Links will be updated off this master posting as I write the subsequent sections.