Creating a plugin that receives data from an API call, modifies that data with a javascript file and returns that data formatted

Im not quite sure how to go about this.

I have written a javascript file that can accept a URL API call, get that data and add html formatting tags to it. I want to create a bubble plugin that allows me to enter in a URL, run it through my javascript code, and return that data as plain text.

I have no idea how to do this because I dont see where data is returned to bubble or where bubble would save that data.

Thanks

That is attached to states.