This is an advanced integration tutorial.
Pre-requisites (not covered here)
Pre-configured Integrations of Google Drive and Google Docs to be activated in your workspace settings
A template doc with variables set inside
You can also use our step templates to create the required steps
First Integration Step - Copy Document
POST:
https://www.googleapis.com/drive/v3/files/[DOCUMENTID]/copy/
Headers:
Key: Content-Type
Value: application/json
Google Drive Pre-Configured integration
Response Variables:
name: id, value: $.id
Body:
use this body if you want to control the filename and where to place the copy. By default, the copy will be placed in the same folder as the original file.
{"name": "insert_name_here", "parents": ["insert_folder_id_here"]}
Second Integration Step - Replace Variables in the newly created document
POST
https://docs.googleapis.com/v1/documents/[DATAREFERENCE_TO_RESPONSE_VARIABLE]:batchUpdate
Header: Content-Type: application/json
Google Docs Pre-Configured integration
Example body with 5 replaced variables in the document:
{
"requests": [{
"replaceAllText": {
"containsText": {
"text": "[NAMEDERINSTANZ]"
},
"replaceText": "{{instance_name}}"
}
}, {
"replaceAllText": {
"containsText": {
"text": "[DOCVARIABLE1]"
},
"replaceText": "DATAREFERENCEVARIABLE1"
}
}, {
"replaceAllText": {
"containsText": {
"text": "[DOCVARIABLE2]"
},
"replaceText": "DATAREFERENCEVARIABLE2"
}
}, {
"replaceAllText": {
"containsText": {
"text": "[DOCVARIABLE3]"
},
"replaceText": "DATAREFERENCEVARIABLE3"
}
}, {
"replaceAllText": {
"containsText": {
"text": "[DOCVARIABLE4]"
},
"replaceText": "DATAREFERENCEVARIABLE4"
}
}]
}