Translating a draft to Spanish

I am looking to translate an entire draft from English to Spanish, using either Google or Microsoft Translation API. I cannot seem to figure out how to do that with a JavaScript script. I have the api key for Microsoft, and have read through the documentation, but I am having trouble putting that together into a request. Any help or a pointer to Action that already does this would be appreciated.