Flows
#
From Kustom 3.70 all layers have a new tab called “flows”, what are flows? A flow is a quick way to get one or more
tasks done with your apps. The Flows tab app lets you create your own automations with multiple steps. For example,
download some data from a site then parse the content and download an image from it, or generate some text every hour
or trigger an animation through a global with some delay after a touch.
...Get a random image on click
#
Flows can react to different things including clicks, in this example we will see how to trigger a Flow by clicking an
item and making the flow pick a random file from a folder and show the image on the widget
Tutorial
#
Steps
#
First of all add a Widget (or a wallpaper or any other Kustom item), then:
...Get title and image from a JSON API every hour
#
Kustom Flows can chain events and store data into files that can be used later in formulas. In this example we will
get some data from an external API (the NASA daily picture API) and store the results locally, we will finally use
that data to display the image and its title
Tutorial
#
Steps
#
First of all add a Widget (or a wallpaper or any other Kustom item), then:
...Random image from Unsplash on click
#
In this simple example #CraftMath downloads a random image JSON from Unsplash using their APIs updating it everything
time a click is triggered
Tutorial
#
Video
#
Steps
#
First of all add a Widget (or a wallpaper or any other Kustom item), then:
- Register Unsplash account and request an API key
- Store API key as a “secret” or normal global, name it “key”
- Create a new text global, name it “json”
- Go to Flows, add a new Flow
- Add a “manual trigger” this will trigger the flow manually via touch
- Add an Action of type WebGet and use “
https://api.unsplash.com/photos/random?client_id=$gv(key)$" as URL
- Add an action to store to a Global, select “json” as the global, flow will download the JSON file and assign the
global to the local JSON file path (unless you switch “store file content not path” which will intead store the file
content in the global)
- Finally add an image, switch “Bitmap” to a formula and use $wg(gv(json), json, .urls.raw)$ to use the image url from
the json
- You are done