Passing variables to API Import

Hey Geoff!

You can build up JSON bodies like this, where there are arrays of objects taken from rows of data.

You will want to first use a Text Merge to create the sets of objects in the array. So that would be using that step to create a column which has the value of:

				{
					"type": "plain_text",
					"text": "*this is plain_text text*",
					"emoji": true
				}

And it will make 1 per row. Obviously it may be different for each type, and you would merge in your columns to create each object.

Now, use a Merge Values step to combine rows that need to be bundled into the same JSON payload. Either by grouping by a specific column, or not grouping, so that every row is merged. Use a comma with no space after it as the delimiter.

That will give you this in a column:

				{
					"type": "plain_text",
					"text": "*this is plain_text text*",
					"emoji": true
				},
				{
					"type": "plain_text",
					"text": "*this is plain_text text*",
					"emoji": true
				},
				{
					"type": "plain_text",
					"text": "*this is plain_text text*",
					"emoji": true
				},
				{
					"type": "plain_text",
					"text": "*this is plain_text text*",
					"emoji": true
				},
				{
					"type": "plain_text",
					"text": "*this is plain_text text*",
					"emoji": true
				}

Now you can merge that column into your array in your payload body so that it is wrapped in [square braces] and you can add all the other trimmings around it!

Let me know if that works.

1 Like