Run Scenario Again If Route 02 Path Is Used?

I have a scenario that makes a request (HTTP: Make a Request) to the Withings API using an access_token which has an organization variable as the value. When the HTTP: Make a Request returns “The access token provided is invalid”, it will then go down the “Token : Invalid” (Route 02) path to refresh the token, which will return a new access_token that is then set as the new value of the organization variable which is now what the original access_token will now use for Route 01.

All this is working fine, I am just trying to figure out once the end of Route 02 is reached, how can I rerun the scenario so the scenario can run through the “Token : Valid” (Route 01) path with the new token?

Hello @nyc,

So I think what you might be able to try is replace the router with an error route.
If the first HTTP Make a Request returns a 4xx or 5xx response code when it’s an invalid token error, then you can right click the HTTP Make a Request and select “Add error handler” then select Resume.
In the HTTP Make a Request settings, enable advanced settings and at the top set this option to Yes

Here is what the new scenario would look like.

The HTTP module just before Resume (#14 in this example) is basically a copy of the original, except it would use the newly-created token. In the Resume module, this will let you basically continue the scenario back at the original HTTP module (#9), except you get to substitute in data from the output bundles in #14.

I hope this helps and hope it makes sense!


Thx for the reply!

I tried something like this initially but the reason I switched is because I don’t have much experience with error handling… when the token is invalid it reports like this:
Screenshot 2023-10-11 at 16.40.22
Will this still work if Status code says 200?

Ah bummer!

Well, the Make app has a “Run a Scenario” module. Will that work in your situation then?

Or, on the second route of your original scenario, duplicate modules 1, 2, 3, 4, 5 and place them after #18?


What would @samliew do here?


Welcome to the Make community!

I’m not quite sure the reason for setting the token variable as the trigger module. Shouldn’t it already be set, or set later down the scenario?

@Donald_Mitchell Instead of the error handler splitting out of module [9] in your screenshot, you can add a module after that to throw the error using the Parse JSON module described here Throw Help Docs | Integromat Help Center.

I like it. Then we can put another HTTP request after refresh_token, but don’t parse the JSON, then pass the raw JSON into a Resume module?


to be honest I’m not sure sure of how this would be best to setup… I’m pretty new to dealing with APIs so I’m learning a lot as I go along. The Withings API is the first 1 I’ve come across where the access_token expires pretty quickly and then needs a request_token to get another access_token so I set it up based on first having a working access_token and then if it doesnt work to request a new one. How would you suggest to set something like this up?

The “Run a Scenario” module works for my needs! Had no idea that was even an option.

Thanks for the help!