Parsing Inbound Cisco Spark Webhook Bot Mentions using Node-Flint

A while back I wrote a post on parsing inbound Cisco Spark webhook data using the hears method with the node-flint framework by Nick Marus. After much thought and general improvement in skill as a developer I have created a much simpler way that could be potentially used with other frameworks. This allows the parsing of slash commands and fallback to a NLP processing service.

Below is a conversations module that can be used with flint. Rather than have multiple flint.hears methods for the event I now have just one using the switch method. Switch allows me to test the contents of my request string variable using regex. A much better solution than multiple flint.hears methods that has limited control over when to stop processing. Once you hit a match using switch it stops processing and performs the function in the return statement.