I don’t know about your team, but at least with the team I’m on, we have a lot of crazy, silly ideas that are very fun to discuss, but likely shouldn’t ever happen to preserve the sanity of those around us.
After seeing our sales team celebrating closed deals with a smash of the carnival hammer game, and our CSMs celebrating closed renewals with a gong-type thing, I’ll admit we were feeling a bit left out.
We started brainstorming what we could do, and our conversation about “how everyone looks cool dancing in strobe lights no matter what” turned into “We should have a fog machine and strobe light for a few seconds every time we close a conversation”
Alas, the smoke machine wasn’t meant to be.
Despite not having a smoke machine, I REALLY wanted to do something now that I was brainstorming.
I arrived at Christmas Lights blinking on and off every time we closed a conversation which seemed both subtle enough to have in the office and timely for the season.
At a high-level, we need a few things to happen to make this work:
- A smart plug that can be reachable with an API endpoint
- A support tool that can fire a Webhook when a conversation is closed (most have this, more below)
- Some kind of server or service that can receive the webhook from the support tool and hit the smart plug’s API to toggle the state
Smart Plug Selection
I do not have a ton of experience in the “Internet of Things” or “Smart Home” space so this was my first real introduction.
All Smart Plugs will have a mobile app that is paired with them, and then you control your Smart Plug primarily with that, or you hook it up with Alexa or something like IFTTT (If This Then That — a very consumer-ized version of Zapier for better and worse).
Since no one has built a Support Tool -> Smart Plug service before, there isn’t anything out of the box for us to use and we’ll need our own way to connect to it.
You must buy a Smart Plug that you can toggle on and off with your code or service of choice. Determine how you’ll turn it off with your code or service BEFORE deciding which plug to get.
For myself, I already had a Node.js server up and connected to our Support Tool for some other operational things. The first thing I googled was “smart plug node sdk” and I found the link for https://www.npmjs.com/package/tplink-cloud-api
This one seemed (and was) perfect because I’ll be able to use my smart app credentials to authenticate and mimic the requests I’d make from the app on my phone.
In conjunction with this Node.js library, I bought this Smart Plug on Amazon:
Support Tool Webhook
A webhook is a way for a service such as Help Scout or Zendesk to let you know that something just happened on their platform. When an event occurs within the platform, it triggers a call to be made to a URL you specify, usually pointing to an API endpoint you’ve designed. The call it makes to your URL contains the data you need to take action.
In our case, we want a call to be triggered when a conversation is closed.
Now that we have a webhook set up, our server will get a ping every time a conversation is closed.
Putting it Together
With a Smart Plug that you can toggle on and off with code, and a way to get notified when a customer conversation is closed, we just need to put these two pieces together and we’ll be set.
Since I was using Node, I built out a helper class like this following the Node SDK for this Smart Plug.
Next, add a Help Scout Webhook function like this:
My Node.js app simply uses Express.js to handle the routing and all of that.
Depending on the plug you buy and your preference for hosting code, your mileage may vary.
Learnings so far:
- Easy to work with APIs for “Smart Home” devices seem to be really hard to find. It makes sense given how consumer-driven and non-technical the market is, but when you want to be technical… it was hard.
- Similarly, I was really hoping to abstract this project out so it wouldn’t be as technical. I had explored services like AWS Lambda, Zapier, and IFTTT to see if I could get to a more “Plug n Play” model for other support leaders wanting to do this. I haven’t had a lot of luck so far, but if you have ideas, I’d love to hear them!
- It’s not the most robust lighting system ever — If it gets two “close” requests at about the same time, it will get off it’s toggle track and the lights will stay on indefinitely. Having the mobile app handy to turn them off when that happens is nice.. :)