Handling dynamic variable values within the Trigger

Hi everyone,

I’m sure there is a simple solve for this, but I just can’t find it anywhere in the documentation.

I get a response from the HTTPS module that looks like this:

Screenshot 2022-10-06 at 06.42.14

The problem is, that ISBN:xxxxxxxx value changes in every response, based on the input to the HTTPS module. See the next response I got:

Screenshot 2022-10-06 at 06.57.55

Basically, I’m searching for a book, getting that book’s data (from HTTPS module) and then want to use that data downstream.

The problem is: The name of the data variable changes with every result, so the workflow downstream doesn’t recognize it and there is no data passed.

Is there a way to handle this situation?

Hey @simonp , interesting and a little complex question :slight_smile:
Maybe someone else has another idea, but this is how you could solve this:

  1. Change the webhook settings to enable “JSON passthrough”. This would send all the data as text within your trigger.
  2. Use a RegEx module using the “Text Parser” → “Match Pattern” in make, and create a pattern to search for the ISBN code. The input data would be the JSON from the trigger.
    After the regex is complete, it would find your ISBN code. This can now be used in the following modules.
  3. Use the “JSON” module to parse the json text from step 1
  4. Use a map() function and try to find the ISBN object underneath Data by searching for the ISBN code you extracted using the RegEx pattern

This maybe sounds like a lot of things, which it is actually, but once you do this a few times it gets easier :wink:
Hope it helps!

1 Like

I think you could also use the key() function to grab the key name. And then parse that.

2 Likes