Alexa: tell ConnectWise Control to...

| By: Jeff Bishop

Not too long ago, Amazon released their voice-enabled smart wireless speaker called: Amazon Echo. Using the wake word, “Alexa,” Echo’s AI, can perform a variety of tasks, ranging from announcing the weather for the day, to providing traffic conditions, and playing music. It serves as a general input point for speech recognition to execute other functions.

Since we’re always looking for ways to expand ConnectWise Control® and integrate it as much as possible, I decided to check out what was possible with Alexa; wouldn’t it be cool to speak commands and have ConnectWise Control act accordingly?

Applications written for use with the Echo are referred to as Skills, as they teach Alexa.  Since this is a loose integration, I decided to explore what could be done with a Custom Interaction Model Skill.  Stepping through the documentation, it looks like the Echo can make HTTP Requests against a pre-defined web server setup to handle them.

Since the callback URI has to be defined by the developer, my Skill can only callback to a single ConnectWise Control instance.  This lack of configurable endpoints is not a show stopper, but I just need to write an Extension with Service methods to handle the actions.

So, the question is now: what actions can we perform?

Since we’re able to make calls to the web service, we can do just about anything that can be done from the host page.  This includes creating sessions, sending messages, running commands, executing tools from the Toolbox, and a few other actions.

Creating a session would be pretty cool, so within the Skill’s Interaction Model I need to define the intent and what kind of data will be passed, in addition to how the phrase may be spoken.  The simplest way would be to invoke the wake word and skill phrase, specify the action, and then specify an argument for how the session should be named.

Within the Intent Schema, I define the intent as Create Session and add a single slot for the Session’s Name, of type AMAZON.LITERAL.  I define the utterance as “Create Session named {Server|SessionName}”.  With the AMAZON.LITERAL type, I must define a default value (server) in case the Echo is unable to understand what is spoken.  This isn’t the most elegant solution, but it’s alright for the moment.

Within the Extension on my ConnectWise Control server, I create a public WebService method to process the call.  To make reading the information easier, I parse the request into an object model I’ve defined to mirror each Alexa request using a JavaScriptSerializer.

Each request contains a wealth of information, but I only care about the intent and the value(s) of its slots.  When a request is received, it is processed and the intent is examined to determine what course of action to take using a switch block.  If the message’s intent is named Create Session, then the Extension proceeds to call into the SessionManagerPool to actually create the session with the defined name.

After publishing the Skill to my Echo to test it, I speak the phrase “Alexa, tell ConenctWise Control to create session named Test,” after which, a Support session appears on my host page named Test. Success!

The ability to create sessions is just the tip of the iceberg, however.

My proof of concept integration can do the following:
  • Execute tools from the Toolbox to a specific remote machine
  • Send messages to sessions
  • Send and execute commands to sessions
  • End sessions
  • Add notes to sessions