Looking for something IoT and humorous that I could incorporate into the workspace, I thought about how I could combine our team's Slack app with a Photon-powered scrolling marquee. The device firmware will loop any message twice. An existing message will be overwritten by a new message.
This project requires you to host a NodeJS api somewhere of your choosing (I chose now.sh), with specific endpoints for firing off custom events off to your device. The api uses credentials populated from an .env file.
You'll want to create a Slack app, and configure the apps integrations to allow slash commands. These slash commands would then point to your api endpoints.
This example uses the following slash commands.:
Command: /hr
URL: path_to_your_server/api/hr
Token: // Take note of this value and store it in your .env file
Command: /display
URL: path_to_your_server/api/display
Token: // Take note of this value and store it in your .env file
Once created, you should be able to use these slash commands like so:
/hr {name} = Go to HR {name}
/display {text} = {text}
You do not have to use Slack.
You can get away with using cURL, You will just need to make sure the body contains text and the correct slash command token.
curl -d '{ "text": "Pete", "token": "your_slash_command_token" }' -H "Content-Type: application/json" -X POST https://path_to_your_server/api/hr
Further explanations of using the attached code can be found here: https://github.com/chrisbuttery/slack-iot-marquee
This project was originally inspired by 'Smart LED Matrix for Particle Photon:' https://www.hackster.io/oz1051/smart-led-matrix-for-particle-photon-144b27
Comments