(App Ver.) Display a message on the M5StickC screen when specific user tweets
Contents
Make Things
When specific user tweets on Twitter, a notification will appear on the M5StickC display. In this article, we show you how to make one as an obniz App.
You can publish and distribute applications you’ve created to other users with the obniz App. Please read App | obniz Docs for more details about obniz App.
Materials
- M5StickC with obnizOS
- Smart Phone or PC
- power supply for obniz
- USB-Type-C cable
You can also install obniz OS on your M5StickC.
→ How to install obniz OS
*By using the M5StickC built-in battery, you don’t have to prepare the battery and cables. However, we recommend powering the device from an external power supply for long-term operation.
How to make
Prepare an M5StickC with obnizOS. You do not need any electronic parts.
Software
Use IFTTT to detect tweets. It is a web service that makes it easy to link various web services and devices together.
Register your obniz Board!
Go to the obniz console and click on “Devices” → “Add Device.”
When the dialog opens, click on “Add Bought Device.” Follow the instructions on the screen to register.
▼
Make your App!
Make an app to run the program. You can distribute apps you created and installed and run on each device(Please see App – obniz Docs for more details.)
If you want to run the app first without creating it yourself, install and run the following apps that have already been created.
→ M5StickCにツイート表示
For installation instructions, see Install an App and the next section, “Install your App on your Device.”
Go to the obniz console and click on “App Development” → “Create WebApp.”
Choose “Empty” from the “M5StickC Templates” and type the name of your app in the window that comes up. Then press “Create New App.”
Then, edit the app settings.
In this case, the program is run by Webhook calls with IFTTT when specific user tweets, so check the “Run on Webhook” box.
After updating settings, click on the “Edit Program” to enter the program editing screen.
Then, paste the program in the M5StickCにツイート表示 link in the “Program” chapter below and save it. Once saved, the application is complete.
Install an App on your device
Install the app you have created on your device. Go to the obniz console and click on “Install.”
Next, select the obniz Board that you would like to run the program and click on “Install.”
Then, click on the triangle icon next to “Open App” and press “Check Webhook URL.”
Make a note of the “Webhook URL(GET/POST)” in the “Cloud Execution Triggers” section of the device setting’s screen. This will be used later for the connection with IFTTT.
Connect Twitter to IFTTT
To run a program triggered by Tweet, use a service called IFTTT, which is a service that allows any web service(app) to run triggered by another web service(app).
Here is the screen for creating a new applet. Click on “This” and select Twitter from the Service.
Choose “New Tweet by a specific user.”
Input specific Twitter ID for trigger (don’t forget to remove “@”).
Click on “Create trigger” to save the settings.
Next, edit the “That” part. Click on “That” and select “Webhook” in the Service. Then choose “Make a web request.”
Enter the Webhook URL you made a note in the “Install an App on your device” section in the “URL” field. Then input {"tweet":true, "content":"{{Text}}"}
in the “Body” field. And fill in the remaining field like the image below.
Click on “Create action” and finish the settings.
Program
Please see the program of M5StickCにツイート表示 that have already been created.
Run
If specific user tweets on Twitter, the notification of “New tweet!” and the contents of the tweet will be displayed on M5StickC. The program in this article only supports tweets with no line breaks.
In this article, we used the Body to get the content of the tweet (Text), you can also get other information such as the user name (UserName).
Try changing the notification text and content to make the notification screen whatever you want it to be.