How can I send multiple records to Integromat webhook?

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:

Thanks

Claire

Hi @Claire_Conza

Try using the HTTP and Webhook modules, using Airtable API for the view, you might need to use JSON parse. In the HTTP module you will include Authorization and Bearer key.

You are correct about the JSON structure (second option) which you will use in JSON Parse module and you might have to use the Iterator.

I found that the webhook might need to be used with the website blob JSON. You would use the http that the webhook generates in the URL window in blob JASON, to make the call. Then you would test the Airtable API in Postman.

Once you have everything set up then you would use the Data tag and place that in the JSON Parse, in the JSON string.

If you like I can take some screenshots of the scenario that I have, using the above modules. It is used for backing up Airtable records. It might give you an idea of how it works.

Mary Kay

Thanks so much Mary!

Any help including screen shots or example code would be super helpful, especially on the airtable side within the automation that sends the webhook.

It’s the syntax of the webhook URL I’m struggling with and making sure if creates the multiple bundles in integromat so I can the run my other modules.

Thanks again. Really hoping I can get this figured out.

Take care

Claire

Hi @Claire_Conza

Here are some screenshots of webhooks and HTTP modules. They are part of a three part scenario to backup Airtable records, which I had help with, since it’s an advanced scenario. Some of the settings you might not need, since they are the advanced settings. You basically need the URL, Method, Body type, Content type and check off parse response.

To test the webhook, try using the URL that was generated in the webhook, by using JSON blob, https://jsonblob.com and JSON formatter for the JSON structure https://www.freeformatter.com/json-formatter.html and Postman to just test Airtable API https://www.postman.com

Here are some documentation, from Integromat, about webhooks, Iterator and JSON. You can also check out Youtube videos, too. I am just providing all kinds of information here, you can glean out what you need. There is also the Integromat Facebook forum, they are a helpful bunch for both Integromat and Airtable enquires.

Here are the screenshots:


Thanks Mary

Much appreciated. Can you share what your automation or scripting block code looks like please?

It’s the airtable side I’m struggling the the most. I’m essence, how to send an array of records to the webhook URL.

I was also hoping that there a way to send all records to the webhook and have them be received as seperate bundles.

Thanks

Claire

Hi @Claire_Conza

I actually used Airtable API to retrieve and create Airtable records. Once I tested the connection with Postman, I then selected the table of records that I wanted, I then copied and pasted the web address, associated with those records, together with the authorization and bear key, into the HTTP module and used the web address that gets generated in the Webhook module.

This is the Facebook tutorial that I watched, maybe it will help:

In terms of the array, I’m afraid that I am not quite sure how to do that, at this time. I am still learning.

I would suggest that you post your questions on the Integromat Facebook page. I am sure someone can help you.

Mary

1 Like

Hi Claire

I found another video by an Integromat member, regarding Automation and Webhooks.

Thanks!

I found that yesterday and that definetly helped put me on the right track. The difficult / issue I’m having is to send an array of records to the integromat webhook not just a single record and I can’t for the life of me figure out how to send an array with multiple values.

My process is hopefully going to be:-

Loop through view and create an array like this…

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

]

and then…

1 Send this array to an integromat webhook
2. search for these PID in another table in another base (airtable)
3. Delete if found

Wish it wasn’t so hard :frowning:

Thank you so much for all your help so far though!

Thanks

Claire

@Claire_Conza

I here you! There certainly is a learning curve.

If I come up with any suggestions/info, I will let you know.

Come to think of it, I could post the last post you just sent me on the Integromat forum and see what response I get? If there is no sensitive information.

Also, if there is other pertinent information.

Let me know.

Mary

Thanks so much! My brother in law is posting furiously on there as he’s more technical than me but no joy so far :-(.

Thanks again for all your help Mary!

Take care

Claire

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:

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

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

Hope this helps! :slight_smile:

1 Like

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?

This topic was solved and automatically closed 15 days after the last reply. New replies are no longer allowed.