I understood your question a little differently than @mishav, but they defiantly know more than I do and have helped me a bunch. I understood it more as how to get data to where you can work with it in JS. Maybe this will help. Here is a post that shows the workings of a simple plugin I put together, I include this for reference because I spent more time trying to figure out what a plugin that actually does somehting looks like than creating this one.
And here is the JS from another plugin I am working on that posts a string to an external API. Dynamic Data is in Bold Italics
$.post(āhttps://apiv2.indico.io/custom/predictā, JSON.stringify({
api_key: context.keys.apiKey,
data: properties.text,
collection: properties.collection,
top_n: 2
threshold: 0.01
}),