For this tutorial we will be taking a closer look at endpoint smartapps by automating a light based on our Zoom presence status. We want to create an automation that will react to our presence status and activate a light when we go “On Air”.
Prerequisites:
- Samsung Developer Workspace Account
- Android Device
- Glitch.com Account
Preparation
Remix the glitch app at this url
Overview
The work of creating a SmartApp using Javascript has been greatly simplified with the following packages
const SmartApp = require('@smartthings/smartapp');
const FileContextStore = require('@smartthings/file-context-store')
The two packages that will be used for this tutorial are the SmartApp SDK and the FileContextStore. The SmartApp SDK provides the boilerplate for creating SmartApps on the platform and the FileContextStore allows one to easily store the context information for the installed app. This context store should not be used in a production environment. For a production environment see the notes in the SmartApp SDK Github Repo.
In the tutorial examples, the glitch app has the name “onairnow”. When you remix the app your glitch app will have a different name.
Creating a SmartApp
Open the developer workspace in another browser tab. One tab should have your remixed glitch app, the other tab should have the developer workspace. You will need to be able to flip back and forth between them during this process.
Select Automation for the SmartThings App
Give the app a unique name
Choose Webhook Endpoint
The Webhook URL is the hostname of your glitch app.
For example my URL is https://onairnow.glitch.com.
Next give your app display and permissions as seen on this screen.
After you submit a confirmation URL will be logged in your glitch app logs. Copy this URL into a third tab and hit enter. This will confirm your endpoint app belongs to you and remove the warning. You will recieve a notification in the window that the app was verified.
Now deploy to test via Developer Mode under test in the left hand menu.
With developer mode enabled in the SmartThings App, you should now be able to install the SmartApp. It will be visible under custom on the “Install SmartApp” screen.
Follow the prompts to install the App.
Once the App is installed, collect your webhook URL from the glitch developer logs. Create a presence webhook only application over at Zoom
https://marketplace.zoom.us/develop/create
Final Notes
If everything is installed correctly your light color should change based on events from the Zoom webhook.