Skip to main content

LINE Notification via Workflow

Loading...

This example demonstrates how the AppBlocks Cloud and its Workflows feature can be used to be notified on LINE when some event occurs on a device connected to the cloud.

Here we assume you have set up a LINE Official Account via the LINE API, generated the channel access token in the Messaging API settings and added the account as a friend from a regular LINE user. Head over to the LINE Messaging API website to get started.

Before you run the project provided with this example on your device, you need to associate the device with an AppBlocks Cloud Device. You can simply do this in the AppBlocks Designer by clicking on the 'Create' button in the prompt showing at the bottom right corner of the screen when you open the designer. Toggle the Cloud feature to Disabled then back to Enabled in the Features => AppBlocks Cloud section of the designer if you do not see the prompt.

Pop up offering to create a new AppBlocks Cloud device, triggered after enabling AppBlocks Cloud on a Tibbo Project System.

Once the device is created, the Designer should have filled the Device ID and Device Password for you.

AppBlocks Editor view of the AppBlocks Cloud configuration modal.

You can now run the project on your device. In another browser tab, head over to the Devices section of the AppBlocks Cloud. You should see your device listed there, with the green status icon indicating that it is online and connected.

Screenshot of the entry of the recently created cloud device in the AppBlocks Devices window.

Moving on to the Workflows section, create a new workflow and give it a name. You should now see a blank canvas similar to the the AppBlocks section of the AppBlocksDesigner. Workflows are simpler in that they only consist of one trigger and a chain of actions executed linearly.

Screenshot of the Workflow tab of the Workflows section, displaying two buttons: 'Set Trigger' and 'Add Action'. At the top, three tabs for Workflow, Settings, and Runs, are shown.

In edit mode, set the trigger to Device Event. Our workflow will indeed be triggered when our device adds an entry to its Event Log.

Screenshot of a Workflow LINE Device Event configuration window in AppBlocks Cloud.

To receive the message on LINE, we will use the HTTP Request action. The parameters are straightforward if you are familiar with HTTP requests. In this case, we want to send a POST request that sends a broadcast (one-to-many) message to the account's friends list. Note that to make the request work, you need to replace the **Access Token** placeholders with your account's access token. You can find more information and messaging types in the LINE API documentation.

Screenshot of the HTTP request block configuration sidebar for a LINE automation workflow in AppBlocks, showing configuration inputs for the HTTP URL, the HTTP method (in this case, POST), the request data (a JSON file), and Request Headers.

Before saving, we will move to the Settings tab to both enable the workflow and allow it to be triggered more than once.

Screenshot of the Settings tab of the Workflows section, displaying two buttons: 'Set Trigger' and 'Add Action'. At the top, three tabs for Workflow, Settings, and Runs, are shown.

Once the worklow is saved, let's finally add an entry to the device's Event Log by pressing the MD button on the device and see the magic happen:

Screenshot of a LINE chat displaying an automated message sent by an AppBlocks workflow running on a Tibbo Project System.

Last, the Runs section of the workflow can also be used to see the history of the workflow runs and to get useful information about the actions and the device state when the workflow was executed.

Screenshot of Workflow LINE Runs displaying the data for an automated message sent by a Tibbo system.