How to pass a JSON map of Values (Tags, Replaced Values) to Create Google Document from Template

Hi,

I wish to create a generic workflow to create google documents from templates from a webhook request.

The webhook contains all of the variables needed: the template DocumentID (as a string), the New DocumentTitle, the target FolderID for the new document, and a JSON string of the Values map, which is an array of key-pair items, “Tags” and “ReplacedValues”.

The idea is that our CRM and a few other services can call this API and it will create new documents from the template, replacing whatever {{tags}} with the “values” passed the Values JSON string. The API call will have a variable number of “tags : values” key-pairs, so this service will be very generic.

I am struggling to get this working:

Here is the JSON string being passed via the webook (as the parameter “Replacements” )

{“Values”: [
{
“Tags”: “tag1”,
“Replaced Value”: “replaced value 1”,
“valueType”: “value”
},
{
“Tags”: “tag2”,
“Replaced Value”: “replaced value 2”,
“valueType”: “value”
}]}

Note: The valueType will be ignored when processing. I am only after the Tags and Replaced Values.

Since the Create Google Document from Template cannot accept a JSON string and expects an Values field that is an array, I passed the JSON string to a Parse JSON module. See image.

You can also see the other values passed in via the webhook here, but we are ONLY parsing the JSON string un 5. Replacements.

The JSON parser works as expected, and I get (I think) an field called Values, which contains (or should contain) an array of Tags and Replaced Values. This is set to the 6. Values field from the JSON parser module.

I add this 6. Values field from the JSON module to the Values map in the Google Doc. See the image below.

However, this will not run, and I cannot understand why. See error, below:

image

I added a “catch bundle validation error” module, which returns nothing on the input and output.

So my questions are:

  1. What is the CORRECT JSON string format for this use case?
  2. Am I passing the Values map correctly to the Create Google Document from Template module, and if not, how do I need to process the JSON.