Could you please advise - how can I create proper 400x webhook responses with “webhook response” module? I would like to transfer Error Message, Error Type and Error Detail.
Here is the context. I have 2 scenarios: “Main” and “Helper”. Main scenario calls Helper scenario using HTTP module and receives some response. Helper listens with the webhook module and responds with webhook response module.
“Helper” scenario has somewhat complicated checks inside and I would like it to return an error with a different “payload” depending on the checks. E.g. I pass an api_key header param and I’d like to return 403 if it’s incorrect; or 404 if some data isn’t found, etc.
I experimented a lot with different “webhook response” settings, but didn’t manage to pass any meaningful info to Main scenario. I ended up at setting it like this:
It returns " DataError Error: 400 Bad Request", but I would like to be able to send more info.
Searched in the forum and in other places, but didn’t find anything related to 400 errors.
Any advice will be highly appreciated. Thanks a lot!
I’ve been able to get meaningful responses from Webhook response modules. For me I wanted to return the status of a previous module in a “Helper” scenario and send it back to the Webhook. I tried building up the JSON string in the Body field of the Webhook response module. But for the “Main” scenario to read the data, I found I had to convert it to JSON and then back to a string in the “Helper” webhook, like this:
I was then able to consume this in the “Main” scenario. I hope this helps you.
In your case, you could return different status uses a
if() function in the Status field of your Webhook response module. Or you could use a Router to break up your scenario and have many different Webhook response modules to deal with the different situations.
If that doesn’t help, please could you give us a bit more detail on what is not working about your current set up, and I’m sure the community will jump in to help!
In your HTTP module in the main scenario, you may need to disable this setting: Evaluate all states as errors (except for 2xx and 3xx).
With this set to No, the module will be considered successful regardless of the HTTP response code. If it does error out, it’s most likely a Make problem.
Then, create filters after the HTTP module to determine whether an error code was returned.
In the helper scenario, you can use a JSON module to create a response structure, sort of like this:
Pass that JSON in the body of the webhook response, like this:
Back in the main scenario, the response would look like this:
Even though the Status code is 403, the module was still successful.
You could add a router to take different routes depending on the Status code, or use a switch() or if() function to check it in subsequent modules, etc…
Hope this helps!
@Terry_Hopper @Donald_Mitchell, thanks for your replies.
My initial approach was to use Make’s built-in error processing engine to streamline scenario behaviour.
However it seems that it’s not possible to get error information passed from Webhook Response with 400 code to HTTP module of invoking scenario. Payload with other codes work fine, I can get see the payload from Webhook response in Postman (when passing JSON like
"message": "Bad Request",
"details": "Your detailed error message goes here."
But HTTP module does not recognise any payload which is sent by Webhook response.
Either I’m missing something or this is simply a limitation of HTTP error processing in this module.
So I had to disable “Evaluate all states as errors” eventually to get payload. Not the best solution but seems there is no choice
If anyone knows how to pass 400x errors from Webhook response and treat them as errors in make HTTP modules - please share your experience
EDITED. I’ve just re-read your message: So the “Helper” scenario is now returning a custom status code (as proved by Postman), but if it’s an error code, then “Main” scenario in Make cannot see your custom message detail?
In which case, @Donald_Mitchell’s solution is the best one.
Yes, exactly. I’ve replicated the issue in 2 test scenarios. Here is what I get when Webhook Response returns 200 or 302:
I have put JSON with a payload into the webhook response and I can easily get it.
But when I chagne webhook response code to 400 this is what I get:
And even if I try to get details with error handler - this doesn’t help:
(I set 3 variables with Error, Message and Detail values in error handler).
So I had to create manual error processing
Yes, I created a test scenario too, and got the same.