Help

Re: How can I send multiple records to Integromat webhook?

4241 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Claire_Conza
6 - Interface Innovator
6 - Interface Innovator

Hi all

I need to send a json payload to an integromat webhook using an automation triggered by a view but I can’t figure out how to prepare the structure of the array it needs.

I want to loop through a table and then pass these records (containing one field) to integromnat.

I can do it with a single value like this when I map PID to a field

let data = input.config();

const returnPayload = await fetch(`https://hook.integromat.com/3gcj7g0zhntlwgkgm6crtdjo3i1jsvmu?PID=${data.pid}`);

var payloadResponse = await returnPayload.json()

console.log("done");

Has anybody done this before please?

This is what I think I need the array to look like but I still don’t know how to add it to the webhook url

[
    {
      "name" : "Peter",
      "ID" : 1
    },
    {
      "name" : "Mike",
      "ID" : 2
    }
]

In which case the output will be a series of bundles, each bundle containing one array’s item:

d1314fcdad49bb1462899a5452bb533bd8018e23.png

Thanks

Claire

12 Replies 12

Hi @Claire_Conza,

Integromat requires you to use this format when sending a JSON array to Integromat:

[
	{
		"Array" : 
		[
			{
				"PID" : "abc12345"
			},
			{
				"PID" : "def6789"
			},
			{
				"PID" : "ghi10111213"
			}
		]
	}
]

Once you’ve got it structured like that, then go into Integromat’s “Webhook” module, and click on the button that says “Re-determine data structure”, and send some test data to Integromat. Then, Integromat will recognize your new structure as an actual array.

But there’s another step — your next module in the Integromat scenario will need to be the “Iterator” module, which can be found under Integromat’s “Flow Control” options. Set the “Iterator” module to iterate through the Array[], not the PID.

Then, your final module can be Airtable’s “Delete a Record” module (or whatever module you want to use in Airtable). You will need to point it to the PID from the “Iterator” module, not the PID from the original “Webhook” module.

So, your final scenario would look like this:

Screen Shot 2020-09-06 at 11.56.42 AM

If you click on the Iterator module, it would look like this:

Screen Shot 2020-09-06 at 11.57.23 AM

And if you click on the Airtable module, it would look like this:

Screen Shot 2020-09-06 at 11.58.16 AM

Hope this helps! :slightly_smiling_face:

Thanks Scott

That’s by far the best explanation I’ve had - thanks so much!! Can you help with how would I create that array structure in a loop of my records within an automation script please?

Thanks

Claire

Sorry, I don’t know how to do that! But are you sure that you need to send the records from Airtable to Integromat? Can’t you just use a simple “Search Records” module in Integromat to search for the records that you want on a regular time interval?