How to dynamically parse any webhook recived data and save as full JSON to Google Sheets

Hello Make community!

I’m looking for guidance on creating a flexible solution for handling webhook data in Make.com and saving it to Google Sheets. Here’s what I’m trying to achieve:

  1. Receive data from various JSON structures to webhook
  2. Parse the incoming data from webhook module, regardless of its structure.
  3. Save the full JSON to a Google Sheets spreadsheet.

Current approach:

Example output bundle from Webhooks’s module:

[
    {
        "value": "{\"recent_messages\":[{\"creation_time\":\"2024-08-26T08:25:37.097Z\",\"message\":\"zzzz\",\"is_reply\":false},{\"creation_time\":\"2024-08-27T09:44:28.56Z\",\"message\":\"aaa\",\"is_reply\":false}],\"conversation_id\":\"aaaa\",\"campaign\":{\"name\":\"asdasd\",\"id\":zzzz},\"sender\":{\"id\":zzz,\"first_name\":\"aaa\",\"last_name\":\"zzzz\",\"full_name\":\"zzz\",\"email_address\":\"sss\",\"profile_url\":\"zzz\"},\"lead\":{\"id\":\"zzzz\",\"profile_url\":\"zzz\",\"first_name\":\"aaa\",\"last_name\":\"2\",\"full_name\":\"aaa\",\"location\":null,\"summary\":\"aaaa\",\"company_url\":null,\"company_name\":\"Czzz\",\"position\":\"zzzz\",\"about\":\"xxxx.\",\"email_address\":null,\"tags\":[],\"lists\":[{\"name\":\"zzzz\",\"id\":87261,\"custom_fields\":{}}]},\"timestamp\":\"2024-08-27T09:44:28.7141499Z\",\"event_type\":\"message_sent\"}"
    }
]

Example of current JSON output saved to Spread Sheet:

[{"lead":null,"sender":null,"campaign":null,"timestamp":null,"event_type":null,"recent_messages":null}]

Questions:

  1. How can I ensure that any JSON structure from the webhook is properly parsed, especially considering the varying structures from different sources like Phantom Buster and Heyreach?
  2. What’s the best way to save the entire JSON as a string in a single cell in Google Sheets, while also potentially extracting specific fields for separate columns?
  3. Is it possible to do this entirely within Make.com, or do I need to use Google Apps Script? If so, how can I integrate it seamlessly?

Any examples or step-by-step guidance would be greatly appreciated. Thank you in advance for your help!

1 Like

Hi @Kona

You do not need any aggregator as webhook always receives one entry at a time. Then transform to json will convert the data into json.

Regards,
Msquare Automation - Gold Partner of Make
@Msquare_Automation

1 Like

Hi @Msquare_Automation

Thank you for your suggestions. I wanted to go with this approach before, but currently, I’m unsure how to pass all the received webhook data to the JSON module.

I cannot just pass “WEBHHOK” to the “Object” field(in JSON Module).

On the Webhook module, the JSON pass-through option is set to “Yes”

1 Like

@Kona

You should set “json passthrough” to “No”. Then you won’t need any other module.

Regards,
Msquare Automation - Gold Partner of Make
@Msquare_Automation

2 Likes

Thank you, that worked!

1 Like

@Kona

Glad to know and appreciate your acknowledgement.

Regards,
Msquare Automation - Gold Partner of Make
@Msquare_Automation

1 Like