Hi, I want to trigger a scenario from another scenario. In my case, there are two scenarios getting woocommerce data from different websites, but they should both trigger the main scenarion where the data is processed.
Now, I can use the module “run scenario” from the make app - but what is the corresponding trigger module in the main scenario to receive the data?
Hello @Christoph_Hillen,
Your “main” scenario, the one that does all the processing of woocommerce data, can be set up to receive scenario inputs and can pretty much start with any module. This is not available on all plans, though.
A more universal option is to set up your main scenario with a webhook.
You helper scenarios that get the woocommerce data would then use an HTTP module to send the data in a payload to the main webhook.
Use HTTP “Make a request” to call your main scenario’s Custom Webhook URL to trigger it.
Put the data in the BODY as JSON. To create JSON, use the “Create JSON” module.
(ignore the scheduling parts, I reused the screenshot from another thread)
Yes, I know that webhook solution in priciple. But how do I tell the HTTP module just to use all the bundled data? I can manualy add all fields, but that would be a bit too much. Also, fields can change by woocommerce oder.
output.txt (45.0 KB)
l
But how is the scenario set up to receive scenario inputs? It is available on my plan.
You can use the HTTP “Make a Request” module to Get the order from Woocommerce, that have the option of “Parse response” set to NO.
This will allow you to map the entire Order JSON as JSON string variable in another module.
Alternatively, you can manually build the JSON structure you want.
This is well documented here including how to execute the scenario via the Make API using the Make app (near the bottom of this help document).
I made a short video so you can follow along – it’s quite nifty but does have some differences between this approach and setting up a unique webhook for each scenario you wish to run from another scenario.
Alex, thanks for this detailed response, it helps a lot to understand it. The fact of data loss in case of an error in the “main” module is a good and relevant argument to use webhooks instead. Thanky you again!
Thanks samliew! So, I struggle in the part of mapping the entire order JSON. How can I put it into the body?
I said, instead of WooCommerce “Get an Order”, replace it with HTTP “Make a Request” module.
In your HTTP module settings “Parse response” field, select “NO” (it is “No” by default)
Basically the opposite of this screenshot:
This will allow you to map the RAW JSON string response in subsequent modules (instead of converting it into a collection of variables.
It’s not an error in the scenario you’re calling that would cause data loss. It’s it that scenario is off for some reason your calling scenario would get a 429 error but of course you could try again later and that error 429 would get reported to you via email and be in the history so it could be run again.
Ok I see. From where do I get the URL to receive the woocommerce oder?
The main scenario’s “Custom Webhook” webhook’s URL of course!
When you create a webhook you can view/copy the URL.
samliew – request private consultation
Join the unofficial Make Discord server to chat with other makers!
Seems like we dont understand each other.
So, I need two scenarios, each one receives woocommerce orders from different websites. Each of these scenarios should send the whole order (raw JSON) to the “main scenario” which processes the data.
Now, to send data from the two scenarios to the main scenario, I use the webhook module which provides me a URL. But to receive the woocommerce data, you suggested to use the “make a http request” instead of woocommerce “get order” module. And in this “make a request” I need to fill in a URL, which should point to the woocommerce website. But what is this URL? In the woocommerce backend, there is no URL provided for this.
Sorry, I misunderstood, since I thought we were still discussing the calling of the main webhook scenario from the two sub-scenarios. (this is what happens when we continue a thread after a week, after I’ve seen a thousand other posts! )
It depends on which endpoint you want to call on your WooCommerce website.
For a start, there is List all orders and Retrieve an order.
samliew – request private consultation
Join the unofficial Make Discord server to chat with other makers!
Ok, so I tried this. But I get back an error “cannot view”. Did I miss something? Is the key/secret constellation right?
Sorry, I don’t have WooCommerce so I can’t help you further here.
You can also suggest for a module for this endpoint to be made in the Idea exchange. Don’t forget to search for it first, just in case someone already suggested it, so that you don’t end up creating a duplicate.
You can also complete this brand new course/tutorial in the Make Academy on how to use external APIs — API calls with HTTP modules
- API and Endpoints
- Header and body
- Multipart/form-data
- OAuth 2.0
samliew – request private consultation
Join the unofficial Make Discord server to chat with other makers!