Has anyone found a way for Tadabase to “watch” or get notified when a scenario has been completed in Integromat before executing a Javascript page or component refresh?
I want to refresh 2 tables when my Integromat scenario is completed. I can refresh the tables using this solution from @Chem
So this part is solved.
Now for the Integromat scenario completed notification, I tried to use a status field (Integromat scenario “OFF” / “In progress”) which is set to “In progress” by Integromat at the start of the scenario and back to “OFF” when it’s completed. Then displayed the status field in an html or details component.
Using Javascript, I wanted to “read” the status field in its html or details component, them refresh it after 500ms and loop through this until the value changes to “In progress”. Then it would continue to loop until it’s back to “OFF” when page (or other components) would be refreshed.
My problem is that I can’t figure out how to refresh the details or html component that contains the status field. The only component refresh I found is the link above using Javascript to refresh tables by “clicking” their refresh button. Worst case, I’ll experiment by displaying my status field in a table but this means it will have to be a child record so it makes things more complicated.
There must be a way to do this using @Chem 's magic javascript solutions!!?? Any solution would greatly improve the user experience!
Hey @Gaudspeed, this might seem scary at first, but I think it will mostly just work with some copy/paste.
The cleanest way of doing this is by utilizing Websockets. Not much you need to know here other than you’ll need to sign up for a great service called Ably.com. After signing up, get your API key and save it we’ll need that soon.
Next, on each page/layout (or even in the header inside a script tag) add this code:
//Subscribe to a channel. "quickstart" can be anything you wish. But make note of it, you'll need it when creating the Integromat Scenario.
const channel = ably.channels.get('quickstart');
//Here we are listening for a new message to the channel. Specifically messages with the the key of "scenario-completed" - again, this can be anything you wish but will be necessary in the Integromat phase.
channel.subscribe('scenario-completed', (message) => {
Swal.fire('Awesome!', 'Data has been updated! Please refresh your page. ', 'success')
});
Finally, in Integromat, add a HTTP module that will send a custom request to the following URL:
Hey @moe, I have one last question regarding this: How can I add some code to be executed after the “scenario-completed” message is received through the Ably channel confirming Integromat scenario is completed, but before the Sweet Alert?
For example: Let’s say I want to refresh the page using location.reload() and, when completed, show the Sweet Alert pop-up?