Hi @Claudiu ,
Could you please provide the outputs of the ReadMessages Action?
It seems that not an array, Apply to each Action requires an array as input.
Based on the screenshots you provided, maybe you could try using the expressions like this:
outputs('ReadMessages')?['body']?['Id']
outputs('ReadMessages')?['body']?['Messages']

Best Regards,
Charlie Choi