The original requirement was pretty simple:
I have created one boolean custom field in the Inventory item and now I want to change the webhook behavior so that it will trigger only for those specific inventory items where that boolean field is true.
And I believe you've been provided with a perfectly appropriate way of achieving that.
However, with the addition of this new information:
sameermoin wrote:The problem is that I am calling 3-4 API calls on the other application when this webhook is triggered, to get my desired response I want to merge all of them into this webhook response. To do that I have created my own Inventory class with all the required properties that I need on the other ends.
It's already sending a JSON and instead of that, I am trying to send my own response.
It seems to me to be a lot different to what you were originally asking, and so much so at the previous solution to your original question might not be able to be used or modified to satisfy thew new requirements. I actually don't even really understand what the new requirements are... It's beginning to smell very complex and REST principles work best with simple, not complex.
When you say " I am calling 3-4 API calls on the other application when this webhook is triggered" - are you making these calls inside the Jiwa API? Or are you making them in whoever receives the webhook coming out of Jiwa?