UPDATE!!! June 13, 2016: The code is now posted.

If you’re not a developer, here’s the short story: I have made a service that extends the value of Cisco Spark by adding cool things like pinning the latest message in a room (for later actions) and making the room public (everybody can join from a web page), as well as a VIP tracking feature that allows you to track all messages a named VIP person has posted across all the rooms. Below I explain a bit more, and I also plan to make the code available, so you can adapt and make your own services. However, if you just want to try the Spark extension service, here you go: https://spark-army-knife.appspot.com

If you want some more background or if you are a developer interested in the Spark APIs, read on!

I hope my demo Spark app post got you started on using the Cisco Spark APIs. If not, or if you just want a cool tool for your Spark usage, I have continued tinkering in my spare time (my day job is as lead architect for the premise conferencing portfolio), and I thought I’d share some more with you. The demo showed you how to make a simple app on Google App Engine and set up authorisation to get an OAuth token from Spark. Those are the fundamentals for making an app that any Spark user can use.  You then store the token and use it to do API requests on behalf of that user to create rooms, send messages, and everything the Spark APIs allow you to do.

The most important part of making an app that can work for many users and offer lots of functionality is to register callbacks (i.e. webhooks) in each of the rooms to get new messages. To support many users, you need to match the callbacks to the right user, retrieve that user’s token, and then do what your app is supposed to do. Back in 2007, I developed a programming framework called ActingWeb made for creating small apps running in the cloud to represent a device or a service on behalf of a particular user and expose small sets of functionality (in a standardised way) to other applications/services through REST APIs. Today it is a part of what is called the Internet of Things.

However, ActingWeb is perfect for a Spark app as you can make code that only focuses on one user at the time, and in a fully stateless way (it is only driven by REST requests from Spark or web requests). This gives you very simple code, and you can quickly add new features. It also has a lot of built-in functionality necessary to create a new user, connect to an OAuth API service and store information (e.g. the OAuth token) for a user, delete the user, and so on.  I have made an ActingWeb python library, so I built the Spark demo app on top of my ActingWeb library and created the Spark Army Knife.

When you sign up as a user of the Spark Army Knife, it will create a Spark room to communicate with you. See below for a snapshot of the new room. Your personal bot then sends you a greeting and if you type in /help, you will get a list of available commands.

Screenshot 2016-03-26 14.28.34

It also registers webhooks in all your rooms to get real-time notifications of all messages in all your rooms. This allows Spark Army Knife to get notifications of all new messages, and, if you are the sender of a message, it will retrieve the message to see if you are sending it a command. This means that all the / commands are available in all your rooms! It thus acts as your personal bot! (note: this bot acts on your behalf and everything it does looks like it is done by you. Often, a bot will have it its own identity, so you can see that a bot is doing stuff, but this is not supported on Spark APIs just yet. Just a good thing to have in mind.)

Currently, Spark Army Knife gives you the following features:

  • tracking of messages from VIP persons, so you can get a list of messages from a specific person regardless of where the messages were posted
  • a simple way of getting a public web address for people to join the room themselves
  • a super-simple way to pin a message, so you can save it for later (pinned messages are sent to the Army Knife Control room)
  • …and then whatever I’ll come up with when I have some spare time. Do a /help once in a while to see if I have added something

Below is an example of the tracking functionality (I have erased email addresses in the screenshot). In the Army Knife Control room, I added tracking of myself (with greger as a nickname), then I sent a couple of messages in two different rooms, and finally, when I typed in /get greger, I get a list of messages. (Note that the actual texts of the messages were never stored in the App Engine app, just the reference to the messages, so when I type in /get, the app retrieves the text and pushes it directly to me without storing anything.)

Screenshot 2016-03-26 14.35.52

If you want to make a public room, so that anybody can add themselves to the room, you can use the /makepublic command in the room you want to make public. The /makeprivate command disables the URL.

Screenshot 2016-03-26 14.54.38

You can use an URL shortener to create a shorter URL. When clicking on the link, you get something similar to the below:

Screenshot 2016-03-26 14.54.54

Well, I think you get the idea, feel free to sign up and try for yourself at https://spark-army-knife.appspot.com 

Many people will probably find the /pin feature useful: In any room where you see something you want to follow up, a link or something, just type in /pin to pin the last message in the room (or /pin 5 or any number to pin the message five messages back). The message will be posted to the Army Knife Control room, and your /pin command will immediately be deleted from the room where you pinned the message. Later, when you pick up the pinned message, you can delete it when you are done with it (or just keep it).

A word of warning though: I have no idea how many will sign up and what the processing and storage requirements will be, and as the app is running as a free Google App Engine app, it may hit the quota limit. So, for now, I’ll just open up for usage and see what happens. So, don’t bet your life on its functionality…

When I get some more time, I will share more of the code behind this app, including more about the ActingWeb framework and library. UPDATE!! Here is the code posted! (June 13, 2016)

Feel free to ping me on Spark with issues/bugs, feedback, thoughts, ideas, or if you just think it is useful! Just remember that I don’t offer any support or guaranteed response time… 😉

A few words about security and privacy if you are interested in that:  First of all, this app gets an access token to all the Spark API functionality, so it MAY do a lot of things. If you don’t trust me, don’t use it for an account with sensitive messaging. I have turned down logging, so only warnings and errors will be logged, and no information about messages, rooms, or anything sensitive will be logged. In order to offer the functionality, the email addresses of you, the OAuth token, the tracked VIPs, and a list of all your rooms, and their titles are stored in Google’s data store. Also, for all the messages that are tracked, the Spark ids are stored for each message, together with a timestamp.

Well, I use the service myself and I’m not too worried, but the typical business user’s Spark account probably offers more sensitive messages than your average Facebook account (where you grant such access all the time), so I thought I should give you a proper warning and information about what is stored.

Leave a Reply

Post Navigation