PRICING
PRODUCT
SOLUTIONS
by use cases
AI Lead ManagementInvoicingSocial MediaProject ManagementData Managementby Industry
learn more
BlogTemplatesVideosYoutubeRESOURCES
COMMUNITIES AND SOCIAL MEDIA
PARTNERS
Are you tired of copy-pasting your documents into translation software just to communicate with your international clients? Or maybe you're automating collaborating on a research paper with a partner who speaks a different language. Whatever the case may be, we've got some exciting news for you! Thanks to the integration of Google Docs and OpenAI, and with the help of Latenode.com, we're proud to offer a streamlined workflow that allows you to give a link to your Google document and translate it into the desired language. No more wasting time on manual translations - let technology work for you!
First, as always, make sure that we have everything we need to create a chain: an account on ChatGPT and Personal key from it, as well as a Google account and the same token;
In Latenode not so long ago added integration with many services, while the exact documents have not yet been implemented, but soon should tighten it up as well. So for now we'll get the token in the old way according to the instructions in our article, only in the list choose "Google Docs API v..." scope "https://www.googleapis.com/auth/documents";
Personal key in ChatGPT can be viewed or created here in the profile settings:
The first thing we do, as always, is to create a node: "+ Add Node" => "Http" => "Webhook";
Let's copy his address at once;
Save the changes;
We will also prepare a preliminary request for the rest client (Postman, Insomnia):
REQ for rest client:
Change the Webhook link to yours;
Then let's substitute our ChatGPT key into personalTokenChatGPT;
Next, put your Google Doc token into googleDocToken;
Change docID to the ID of the desired document, it can be taken from the address bar;
If necessary, you can change the translation language in the language parameter;
Next add the "HTTP request" node to get the content of the document: "+ Add Node" => "Http" => "HTTP request";
Save;
Bind the nodes together;
Start and call the chain to transfer data between the nodes;
Let's form the "Url" field: let's start with "https://docs.googleapis.com/v1/documents/" address, followed by the parameter body.docID from the "Webhook" node;
Let's check that the default method is "GET";
In Headers let's add two:
- Content-Type with value: application/json
- Authorization in the value enter Bearer, then select the parameter from the "Webhook" node with the name: body.googleDocToken
Let's save the changes;
Bind the nodes together;
Start and call the chain to transfer data between the nodes;
Next add a "JavaScript" node to get the content of the document: "+ Add Node" => "Code" => "JavaScript";
Insert the content from the block below into it:
Save;
Bind the nodes together;
Start and call the chain to transfer data between the nodes;
Open the "JavaScript" node settings again;
Let's check in all constructions like "data["{{2.body.body.content}}"]" and "data["{{2.body.body.content}}"]" that the node numbers correspond to those from which we receive data, if not we replace them with the necessary ones (remind that 1 is the node number which is written immediately below the node name above the node type, then if it is a query then we select the object field responsible for the type of data sent/received - body for forms or query for query parameters);
If there were changes, let's save them;
Now let's add another "Http request": "+ Add node" => "Http" => "HTTP request";
Save;
Bind the nodes together;
Start and call the chain to transfer data between the nodes;
Let's form the "Url" field: let's put "https://api.openai.com/v1/completions" address in the beginning;
Change the request method to "POST";
At the body in "raw": let's substitute the variable resultRawJSON from the previous "JavaScript" node;
In Headers let's add two:
- Content-Type with value: application/json
- Authorization with the value: Bearer, then select the parameter from the "Webhook" node with the name: body.personalTokenChatGPT
Let's save the changes;
At the end, to return the text received from ChatGPT let's add the "Webhook response" node: "+ Add Node" => "Http" => "Webhook response";
Save;
Bind the nodes together;
Run and call the chain to transfer data between the nodes;
Fill in the response with the ready variant if there was a successful response from the previous request body.choices.[0].text:
Let's run the full chain and call it;
After that, the answer should return a brief paraphrase of the document in English;
The finished chain will look like this at the end;
Thanks for your attention, see you in new articles!😉