[RELEASE] Webex Notification Driver

Cisco Webex (formerly known as Webex Teams) is used for collaboration in many organizations. If you're already a Webex user it just makes sense to bring your Hubitat notifications into the app. Even if you're not a Webex user, this driver will work with a free account.

Setup Instructions:

  1. If not already using Webex, sign up for an account at https://teams.webex.com. Enter your email address and if you don't have an account and your domain name is an enterprise customer already, you will receive an email to activate your account. Activate it, set a password, set your display name. Click on Try Messaging to begin.

  2. Create a bot account at https://developer.webex.com. You'll have to sign in using your user account (that you set up in step 1 if not already on the platform.) Click on the link for Bots or otherwise create a new bot at https://developer.webex.com/my-apps/new/bot. It will require a globally unique username. Upload a cool icon, or use one of the defaults. Take note of the username (your_bot_name@webex.bot) as well as the Bot API access token.

  1. Create a space that you will use for your notifications. You'll probably want to install the mobile and/or desktop client(s) on your devices. Once in the app with a space created, invite your bot from step 2 to the space using the three-dot menu in the space.

  2. Navigate to Rooms - List Rooms | Cisco Webex for Developers. If your browser is still logged in to the Webex platform you'll see your initials up top. If not, log in. On the right hand side of this API reference change the Authentication to use the bot's API token (1 & 2 in image) then run the command. From the response section at the bottom, identify the room you added your bot to. Copy the ID (3 in image) and store it somewhere.

  1. Add the two drivers (the parent and the device) to your HE hub (Drivers Code).

  2. Create a new virtual device and set the type to Webex Parent and Save Device.

  3. Enter the API auth token for your bot and press Save Preferences.

  4. In the create device command, provide a label for your notification room on Webex and supply the room ID that you captured in step 4.

From here you can use the notification device in Rule Machine, webcore etc.

The driver can be found here:

Special thanks to @ritchierich for his Twilio driver used as the base for this driver.

To-do:

I would like to automate step 4 (and maybe step 3) at some point but the extra steps are one-time-only. Will invest the time if it turns out a lot of people use this driver and if feedback indicates the extra steps are onerous.

6 Likes

Cool !!! Looks like I know what I'll be playing with tomorrow (or tonight still)

1 Like

@rylatorr
Got it all setup ! Works perfectly. Now I can get notifications on my computer for my hubitat stuff. Thanks

1 Like

I was able to get this going, and plan to migrate Hubitat notifications over to this mechanism.

I'd be interested in being able to respond to the bot and perhaps process that on the Hubitat side. What do you think?

That would be cool, reminds back in my openhab days and the XMPP chat type stuff you could do. @doogles just curious what examples would you use it for since you can remotely use dashboards ?

1 Like

Interested to hear the use cases as well. At one extreme a full blown chatbot could be implemented to interpret commands and perform actions. Webex has 'cards' functionality that could be applicable for menu based operations too. But these possibilities seem at first thought like they'd be reimplementing things already done elsewhere.

I think if I were to try a chatbot, it would be implemented with an intermediary service in the cloud, sitting in the middle of the WebEx and Hubitat APIs.

Ok, so I had some time to think about the "use case" question. I originally sat silent on this because at first I agreed that there's 100 other ways to control Hubitat that seem more sensible. That said, I came up with a real-world use case:

I'm doing all notifications using Webex, now. While there are other ways to notifications to me, I like the inherent history & timestamps that sending the notifications in Webex provive.

I would love the ability to respond with a keyword or two in order to drive certain actions -- such as replying "OFF" and "ON" or "SNOOZE" to turn the notifications on and off, or simply temporarily shut them up. In practice in my environment, this would simply mean being able to act on select replies in the Webex space. In my environment specifically, the "OFF" and "ON" examples would ultimately drive a "Global Notification Mode Enabled" switch which my rules check before sending anything to Webex.

That said, I suspect receiving anything back from the Webex space would be a lot more complex than what the driver is doing right now, so indeed maybe not worth it. Maybe I just use a IFTTT "Do" button on my phone to toggle the switch.

Thanks for taking the time to write it up! To send a message to the Webex bot would require registering a webhook listener which is why I indicated the code would have to be implemented in the middle somewhere. eg. a cloud function to receive the "off" command and then process it. The control path back to Hubitat would probably have to be Maker API cloud endpoints to take the necessary action.

I agree that this would be pretty cool and convenient too.

The next thing we need is for Cisco to give us the ability to select different notification sounds depending on which space had activity.

I do like how you can change spaces notification behavior (@-mentions only, All) but that's only half the battle: Since I use Webex for work, I now get the same sound regardless of if the notification is re: work or Hubitat. I don't know if I need that level of additional stress in my life. :slight_smile: