You can think of this as a combination of insomnia-plugin-response and insomnia-plugin-js-eval.
insomnia-plugin-response
insomnia-plugin-js-eval
Install the insomnia-plugin-response-eval plugin from Preferences > Plugins.
insomnia-plugin-response-eval