Web Alert's Tasker Plug-in
Tasker is an automation app for Android that allows programming your own automations without
having to be a programmer. Tasker lets you easily set up automations such as that you want to have the Wi-Fi switched on
every morning at seven and that your phone is muted when you connect yourself to your company's Wi-Fi.
The Web Alert Expansion Pack offers a plug-in so that events from Web Alert can trigger actions in Tasker or
any other Tasker plug-in and allow Tasker to trigger actions in Web Alert, such as checking a website for changes.
Examples
The following is a list of use cases to give an idea of the new opportunities that the Tasker integration opens up.
-
Website change notifications can be sent through further means than just a notification on the Android device. Through additional plug-ins and built-in actions the event can trigger sending an email, SMS, Pushbullet message, Twitter tweet or Facebook post. This may also give a new meaning to an old Android device that is left at home.
-
Extract information from a web page. Especially useful when previous steps like logging in are required (with Tasker's HTTP GET this is impossible or too much work). Web Alert lets you interactively select the exact content through clicks, jQuery selectors, filters and regular expressions.
-
Listen to the content of a web page when it updates (read aloud with TTS) or see it in a widget.
This may be the weather forecast or the headlines of your favourite news page.
-
Run certain Tasker actions only when there is a working Internet connection.
Web Alert checks for Internet connectivity and allows Tasker to maintain a variable for storing whether Internet is available. It can then be used in the conditions for running tasks.
-
Record a tracker that accesses your Wi-Fi administration web page (e.g. 192.168.1.1) and turns off the Wi-Fi.
Then create a second tracker that turns on the Wi-Fi. This way you can schedule turning off the Wi-Fi at night and turning it on again in the morning.
-
If your Wi-Fi network requires you to log-in, as this often happens in public hotspots (e.g. public networks from Starbucks or McDonald's typically require accepting the terms of use before allowing navigation), you can automate that every time you connect to this Wi-Fi that the log-in process takes place in the background.
-
A web administrator can create trackers for their websites and then subscribe to the event "Website unreachable" in a Tasker script for these trackers. The administrator can then define exactly what actions to undertake in the event that the website is offline, e.g. let his Android watch vibrate, send an email with the log of the tracker execution to the email address of a college, insert the event in a database and so forth.
-
Integrate with IFTTT and Zapier: through the plug-in
AutoRemote you can invoke actions in IFTTT.
For example, check in Web Alert the web page of your current list of grades. Subscribe to the event "Content changed & contains…" and check for a certain keyword
(e.g. pass) so that you get alerted when you have passed the exam. You can then use IFTTT to post a message on Facebook saying that you have passed.
States
States are conditions that can be used for running actions. Web Alert offers the following states:
-
S1: Tracker has unseen changes
This refers to trackers that had noticed a change in the tracked content and had showed a notification to the user but the user has not yet taken a look at the changes or dismissed the notification.
The state can be used for example to let the LED shine in a specific color until the user reacts to the notification.
-
S2: Tracker has a problem
A tracker with a problem refers to when the last check resulted in a non-successful outcome, e.g. when there was a network exception during communication with the website or when the content to be observed for changes could not be found.
-
S3: Current content contains…
This allows to check if a certain text is found within the most recent version of any selected trackers' content. You can specify the search query to be a regular expression and decide if the search is case insensitive.
-
S4: Current content does not contain…
This allows to check if a certain text is found within the most recent version of any of the selected trackers' content.
Note: this is not the exact opposite of S3 when applied to more than one tracker because the negation of S3 means:
Current content in ALL selected trackers does not at the same time contain a certain text (which is usually not desired).
-
S5: Website is unreachable
When checking the website fails with a network exception although in general there is Internet connectivity.
-
S6: No Internet connectivity
When the Android device is deemed to be offline.
Events
Events are triggers for running actions. Unlike states they are instantaneous. Web Alert offers the following events:
-
E1: Tracker's content changed
An event fired when a tracker was checked and it was determined that the content on the web page has changed.
Normally Web Alert only shows a notification but now further actions are possible.
-
E2: Content changed & contains…
Fired when any of the selected trackers' content changed (like E1) and the new content contained the specified text (or the regular expression found a match).
-
E3: Content changed & does not contain…
Fired when any of the selected trackers' content changed (like E1) and the new content did not contain the specified text.
-
E4: Tracker was checked
Triggered any time a tracker was checked. This event generalizes all other events so that it always occurs together with any other event.
-
E5: Tracker failed
The tracker was checked and resulted in a non-successful outcome (network error, content not found, etc.).
-
E6: Website was unreachable
The tracker could not be checked because there was a problem with the connection to the server, although it was possible to successfully
communicate with another server, indicating that the problem is on the server-side.
This event is meant to help website administrators to be alerted when their website is down.
Actions
When the selected event or states occur then the automation app executes a task, which is a list of actions.
Web Alert expands Tasker with the following actions:
-
A1: Check tracker
Causes the execution of a tracker. This execution can be influenced by providing arguments for discovered parameters of a tracker (e.g. form fields or cookies).
The action has return variables, that will be filled with the values of the tracker that was checked including the textual content found on the web page.
This action allows using Web Alert for retrieving and extracting web page content and also for
automating tasks on websites,
like filling out form fields and sending them.
-
A2: Enable tracker
Enables the tracker so that it is getting checked for changes in the background.
-
A3: Disable tracker
Disables the tracker so that is does not check automatically for changes. Disabled trackers are greyed out in the list of trackers.
The tracker can still be checked manually in the user interface and automatically with the action A1 and the option that also disabled trackers are included in the selection.
-
A4: Enable background checks
Globally allows Web Alert to perform checks in the background.
-
A5: Disable background checks
Globally turns off that Web Alert may perform checks in the background.
The tracker can still be checked manually in the user interface and automatically with the action A1.
-
A6: Enable notifications globally
Allows Web Alert to show notifications, e.g. when a website has changed.
-
A7: Disable notifications globally
Turns off that Web Alert shows notifications. This may be useful at night
or during a meeting.
-
A8: Change default Wi-Fi frequency
Sets the default checking frequency for Wi-Fi. It applies to all trackers
that do not have an individual checking frequency set.
This allows adapting the frequency to contextual information such as when
the device is connected to a power source.
-
A9: Change default mobile Internet frequency
Sets the default checking frequency for the mobile Internet. It applies to all trackers
that do not have an individual checking frequency set.
This allows adapting the frequency to contextual information such as when
the when the battery level is low.
-
A10: Change tracker Wi-Fi frequency
Sets the checking frequency for the selected trackers for when the device is connected to the Wi-Fi.
-
A11: Change tracker mobile frequency
Sets the checking frequency for the selected trackers for when the device is connected to the mobile Internet.
Return variables
When Web Alert sends an event, reports that a condition/state is fulfilled or when an action is executed,
it sends variables that can be accessed in the automation script.
For both privacy reasons and performance, many variables need to be enabled (by marking the checkbox) before
they are returned.
- Tracker ID (%watrackerid)
A number to identify the tracker within the app. You can receive this in an event and use
the variable later in an action of Web Alert to refer to the tracker.
An example automation could be that in the event that the website content contains the text "Auction closed" to launch the action to disable the tracker.
- Tracker Name (%watrackername)
The name given to the tracker. By default this is the domain name, e.g. amazon.com
- Version ID (%waversionid)
A number to identify the new content on the page.
- Result repetition (%warepeated)
How many times in a row the current check result (e.g. "no changes") occurred.
This may be useful for website administrators so they can register to the event that
the page was unreachable and only send an alert when it happens twice in a row to prevent false alerts.
- Execution duration (%waduration)
How much time checking the tracker took (in milliseconds). Can be used for collecting data for statistics.
- Final URL (%wafinalurl)
The web page address that is checked for changes. This can be used to launch another tracker
that repeats the navigation starting from that address (for web tasks).
- Cookies (%wacookies)
The cookies that were set by the server when checking the website.
They are stored in the form name=val;name2=val so that they can be used directly with Tasker's built-in HTTP Get and HTTP Post.
This way Web Alert can be used for logging in at a website and then Tasker (or Web Alert again) can use the cookies to access web pages of the server that require first logging in.
- Cookies with attributes (%wacookiestore)
Similar to the above but with more data. The cookies are separated by commas and include attributes (which are separated by semicolons),
e.g. name=val; Domain=server.com; Secure, name2=val2; Domain=.sub.server.com; Path=/.
This form cannot be used in Tasker's built-in HTTP Get but it is recommended to use it when passing them again to Web Alert.
By that means you can create a tracker to log-in to a website and another tracker to check a specific web page that requires first logging in.
You can then define the second tracker as a "simple tracker" (which means that it does not repeat the previous steps and directly tries to access the final web page),
and you can run this tracker from Tasker with the cookies provided.
- Log (%walog)
The log messages when checking the tracker. This is useful for website administrators
that use Web Alert to know when their server is down.
- Number of unseen revisions (%waunseen)
How many website changes of the tracker you have not yet looked at.
When viewing the latest changes of a tracker this resets to zero.
- New Content (%watext)
The content of the new version of the website.
- Change (%wachange)
The percentage of change as a number between 0 (practically no change) and 100 (everything changed).
It is the number that is shown in the title of change notifications.
- HTML Diff (%wadiffhtml)
HTML text of the latest change, highlighting what was added or deleted.
- Added Content (%wainserted)
The text that was added in the new version of the web page.
- Deleted Content (%waremoved)
The text that was removed in the new version of the web page.
- Watched Number (%wanumber)
The number you are using as a condition for the change notification,
for example the price of a product. This variable is not yet available.
Input Variables
Tasker can invoke actions in Web Alert and include variables, which shall affect those actions.
This way it is possible to dynamically set the trackers on which to operate, on what page they shall start
checking and with what cookies.
Trackers that fill out forms (e.g. when logging in or when using the
search function on a web page) will offer those form fields so that Tasker can later decide new values for it.
This allows the creation of Web Tasks. A web task is a tracker that is actually not interested in
detecting changes on a web page but uses the record and replay functionality of Web Alert as a means of
doing things automatically on the web.
This web automation can be very powerful. For example, you create a tracker, starting with a product web page in an online store.
You then buy this product and select the message "Thank you for your purchase" on the web page for
checking for changes. You then have a tracker that will always buy this product every time it is checked,
so you will disable it to prevent it from buying more.
You can create a second tracker that checks another product in that online store and watches the price.
You create a Tasker profile that subscribes to its change events and select the variable of the final URL (%wafinalurl) and the content (%watext).
When the price drops below a certain value, you call the tracker that buys the product and pass it %wafinalurl as the start URL.
This way you have set up a system to automatically buy products on the Internet, even while you are not using your mobile.
Other automation systems
The Web Alert plug-in may work in the following automation apps:
- Tasker: used as reference, was found fully working
- Automagic: was found fully working
- Automate: free (with limitations); was found fully working
- Llama: free; can only execute actions and no support for variables
- E-Robot: can only execute actions; not tested