Help

Re: Get the body of a webhook's payload

288 0
cancel
Showing results for 
Search instead for 
Did you mean: 
insightautomate
4 - Data Explorer
4 - Data Explorer

I have an automation triggered by an incoming POST web hook.

I do not have control over the format of this workbook however it send its content as a JSON whose structure can vary but at the top level contains a key "data" which is an array of objects each containing information about a particular answer in a form response.

e.g 

{
  "data": [
    {
      "title": "What survey/inspection would you like?",
      "description": null,
      "type": "choices",
      "key": "d747n",
      "custom_key": null,
      "value": "Level 1 Health Check"
    },
    {
      "title": "",
      "description": null,
      "type": "hidden",
      "key": "4pf996l",
      "custom_key": "age",
      "value": "4"
    },
    {
      "title": "",
      "description": null,
      "type": "hidden",
      "key": "9b8fc",
      "custom_key": "cost",
      "value": null
    }
]
}

This means that the when trying to use the data in a script using inputConfig it wants to create a list of values e.g a list of all "custom_keys" or all "types"... not helpful. Moreover it can't actually create a list of the values for the key "value" as it says

"Cannot assign list of collection of complex types to collection of complex types"

Is there no way to simply get the full payload of a webhook as a variable for my script beyond using some external service to serialize it and then parse  in the script?

1 Reply 1

I thought I may have been able to help with this one, but then found the exact same limitation - we can't simply import the body as an object into a scripting action.

Then I thought, I might try out the recently released Repeating Group action to process your data as a list, but it again hits similar issues, as per the below screenshot.

Karlstens_0-1679123032709.png

"Cannot assign list of collection of complex types to collection of complex types"

This is worth raising as a feature request with Airtable, I dare say it must have been requested countless times already. I've always had the luxury of writing my own Post requests, so haven't hit this problem before.