(App Ver.) Robot That Likes Tweets [ IFTTT integration ]
Contents
Make Things
If you tweet with a specific hashtag, it makes your robot spin around like it was happy.
Materials
* This article is an example project of AI Robot Kit.
- AI Robot Kit
- power supply
- smartphone or PC
How to make
Hardware Connection
Build an AI Robot Kit following the instruction.
Software
The following are the flow of the system we create.
- Tweet with a certain hashtag from your account
- Make a Webhook call of App with IFTTT
- the Program is run and the robot becomes happy
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.
→ ツイートすると喜ぶロボット
For installation instructions, see Install an App – obniz Docs and the next section “Install your App on your Device.”
Go to the obniz console and click on “App Development” → “Create WebApp.”
Select “Browser App (Block Program)” from the top tab, and choose “Empty” from the “obniz Board/1Y Templates.”
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 you tweet something with a certain hashtag, so check the “Run on Webhook” box.
After checking the box, click on the “Edit Program” to create the block program as shown in the “Program” chapter.
In the “move” function below, the AI Robot Kit is programmed to move left and right to look happy.
Here, make sure to put the last block to stop AI Robot Kit. Without this, the robot won’t stop moving.
Also, in the following part, if the program is be running in the cloud(received Webhook call), it sends a success status at the end.
Install your 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.
Then, click on the triangle icon next to “Open App” and press “Check Webhook URL.”
Make a note of the “Webhook URL” in the “Cloud Execution Triggers” section of the device setting’s screen. This will be used later for the connection with IFTTT.
Connection IFTTT and Twitter
To run the program by tweets, use a service called IFTTT, which is a service that allows any web service(app) to run triggered by another web service(app).
You can set any service as a trigger, but let’s use the “New tweet by you with hashtag” provided by IFTTT.
Click on your icon (obniz icon in the capture below) next to “Explore” and select “Create.”
Then, click on “This” and select Twitter from the Service.
Choose “New Tweet by you with hashtag.”
Set hashtag for the trigger Tweet to “#obniz.”
Then, click on “That” and select Webhooks from the Service.
Fill in the setting fields. Paste the Webhook URL that you made a note in the URL blank.
You have now completed the system. It makes the robot happy to tweet with the hashtag “#obniz.”
You can extend in various ways depending on IFFFT settings and the obniz program, so please try different things.
Program
It is the same program as the already created app ツイートすると喜ぶロボット.