Can I use a macro after a JSON monitor detects a change?

I am using a JSON monitor on the MacOS app to alert to changes on a site. I would like Distill to start a macro after a change is detected. But of course, the JSON url is not the url for where the macro would run so it can’t run on the tab that opens when the JSON monitor detects a change.
Thanks.

You can perform macro actions on a different URL (URL 2) when a change is detected on the first URL (URL 1). To do this, follow these steps:

  1. Go to “Macro” and add a new macro for URL 2.
  2. In the recorder, update the first step:
    • Change wait_doc to open.
    • Enter URL 2, where the macro actions should be performed.

  1. Record the actions you need to perform on URL 2 and save the Macro.
  2. Add this Macro as action to your JSON monitor for URL 1.

Yes, I have tried this. It works with the macro builder. The macro starts with the JSON URL and open loads URL 2 and the macro continues as desired.

However, when the monitor starts if from the MacOS app, it appears (I’m not sure) that the open command opens a new tab and the macro stops at that step.

I also tested it with the Chrome browser extension. The command does not appear to work at all: URL 2 is not opened and the macro times out in URL 1.

You can try adding the wait_doc step at the beginning of the macro, as shown below, and see if that helps.

I just tested a simple macro: wait_doc, open, click

Same results: OPEN works but then the macro stops and times out before the CLICK executes.

This seems to be a bug.

Can anyone verify if the OPEN step works and allows macro steps after it?

does the click step error out when the macro action is being executed? a screenshot of what you are observing will help understand what could be not working.

I did a very simple test so we can see what I’m doing wrong or if the OPEN action is broken. (I would like to monitor JSON data, but to make things simple for my test I will monitor just one element on a straight forward webpage.)

For the test monitor I have chosen https://time.gov/ (You suggest calling it “URL 1”). It is a clock display webpage and I will monitor the UTC time element because the clock will always be different on every monitor check.

My macro called “Test” is a very simple macro with an OPEN action that will start after the monitor detects a change. It will OPEN a different webpage (URL 2), which for my test will be the distill.io forum page. The macro will then CLICK on the “Replies” column to sort the forum topics by the number of replies and then CLICK on the topic that sorts to the top. (I also added the WAIT_DOC action as previously suggested.)

Here is the macro export file:

{"macros":[{"meta":{"url":"https://time.gov/","blockAdsAndCookies":true},"name":"Test","spec":{"params":[]},"steps":[["wait_doc"],["open","https://forums.distill.io/"],["click",{"meta":{},"type":"css","value":".posts [aria-pressed]"},{"x":0,"y":0},{"delay":0,"frame":0,"button":"left","timeout":30,"clickCount":1}],["click",{"meta":{},"type":"css","value":"tr:first-child .main-link"},{"x":0,"y":0},{"delay":0,"frame":0,"button":"left","timeout":30,"clickCount":1}]],"version":2}]}

Here is a screen shot from the macro builder after hitting “Replay”. “Replay” starts the macro and it opens the URL 2, CLICK sorts the topics by largest number of replies and the second CLICK opened the topic that sorted to the top of the list (that topic is titled “Chrome extension - Watchlist not loading” and has no relation to the topic at hand). This is my desired outcome.

When I run the monitor from the MAC desktop app, here is the result. The macro starts and URL 2 (the distill.io forum page) opens, but the macro stops with no subsequent actions and the macro times out.

When I run the monitor from the Chrome browser extension (on a Chromebook) here is the result. URL 2 does not open.

i see. the desktop app’s open function doesn’t resolve. this looks like a bug in the desktop app.

can you try the following macro using chrome?

{"macros":[{"meta":{"url":"https://time.gov/","blockAdsAndCookies":true},"name":"Test","spec":{"params":[]},"steps":[["wait_doc"],["open","https://forums.distill.io/"],["wait_for_duration",5],["click",{"meta":{},"type":"css","value":"tr:first-child .main-link a"},{"x":0,"y":0},{"delay":0,"frame":0,"button":"left","timeout":30,"clickCount":1}]],"version":2}]}

it was tested to work on my machine. it has following changes:

  1. added a wait_for_duration step after open too ensure that click is applied only after page has loaded. i think it was trying to click too quickly.
  2. changed the selector to click an a tag. old selector was trying to click a td. note that i removed the step to sort the posts to keep things simple.

let me know if it works for you or if you face any isues. thanks!

Thanks! A “wait” step is what is needed after the “OPEN” step.

I had tried that on the desktop app since I was primarily using that, but never with the browser extension.

Question:

  1. Do I need to submit something on the bug in the desktop app so it will get resolved? In the future I would rather use the Mac desktop app than the browser extension.
  2. Do you think support@distill.io would reset my monthly macro actions limit since I have used over half my allowance on the desktop app bug?
    Thanks again!

there is no need to. i have logged this as an issue. it will get fixed in time.

please note that the desktop is in beta because. so, more bugs are expected. we fix the bugs, there are more to be fixed before it can be promoted to stable.

the monthly usage is accounted and managed by the background services. it can’t be reset manually. it resets on the first of every month. but you send an email to billing@distill.io and request a credit.

Thanks so much for the extra help! My macros seem to be working fine now.

In summary, an OPEN step probably needs to be followed by a wait step.
And the OPEN step does not work on the Mac desktop app.

Thanks again.