Runtime Flow Control - User Behavior modelling heavily dependent on the Data returned by the HTTP requests

Hello everyone!

I’m new to Scala/Gatling and I have a question.
I need to simulate users that have different Behavior depending on the output of the HTTP responses.
Each user has it’s own custom data that I fetch with a Request and I need to save in an object in order to use it as a “feeder” for the next requests.
For example in my Database the users have 3 fields (name, authorization_key, customUserArray) and I have populated it with those 4 users:

User 1 {name: Carl, authorization_key:1234, customUserArray: [“my String 1”, “hello 1”]}
User 2 {name: Mark, authorization_key:7777, customUserArray: [“my String 2”, “hello 2”, “Gatling is awesome!”, “45236”]}
User 3 {name: Albert, authorization_key:9999, customUserArray: [“my String 3”]}
User 4 {name: Paul, authorization_key:2222, customUserArray: [""]}

The user’s data is fetched with an initial request, and the data received (in the JSON body) needs to be used as feeder for the next user requests.
The “authorization_key” is user dependent and it is used to authenticate the users for the next requests through a specific custom HTTP Header.

Is there any easy way to “feed” a scenario at runtime and/or change the protocol config at runtime?

I also would like to execute “x” number of POST requests per user, based on the “x” number of elements of the customUserArray (eg: 2 POSTS for User1, 4 POSTS for User 2 …)
How can I achieve such control on the flow at runtime?

Thanks in advance for your help,