Skip to main content
Question

Parsing a garbled payload

  • 24 May 2024
  • 7 replies
  • 43 views

Hi, I am using a webhook that fetches a payload that I have to parse to extract specific information. Please note that the “payload” here is NOT a field in the incoming message (like email_body), but the whole message.

Part of this payload is quite straight forward:

FirstName: XXX

LastName: YYY

ZipCode: 3333

Another part of it is really strange and cannot be directly reconciled to the form “field: value”, as above.

Here a couple of examples, but there are 10-12 of similar sections in the meassage.

  • 3EIGNUNG DACH] Haben Sie bereits eine Bestandsanlage?
  • 3EIGNUNG DACH] Haben Sie bereits eine Bestandsanlage?
  • 1
  • 0
  • UUID
  • UUID
  • 2200da203cde013bad001205644bcef7
  • Label
  • Label
  • Ja, soll aber nicht mit der neuen Anlage kombiniert werden.

 

  • #EIGNUNG DACH] Leistung in kWp:
  • #EIGNUNG DACH] Leistung in kWp:
  • 1
  • 0
  • UUID
  • UUID
  • 3ed4dfb0b8af012d2fb938ac6f7d89ab
  • Label
  • Label
  • 4 bis 7 kWp

It is in German, but the above should correspond to the following real-world information.

  • Key: 2200da203cde013bad001205644bcef7
  • Value: Do you have already a Solar installation? Yes, but I want integrate it with a new one.
  • Key: 3ed4dfb0b8af012d2fb938ac6f7d89ab
  • Value: Power in kWp? 4 to 7 KWp

I want to address the following issues.

I would like to extract the full payload as text and apply something (code, AI, …, at the moment is not important) to extract the info above (key/value) from it. How can I put the whole payload of webhook into a single variable to be used later in the parser?

It would also be OK to extract only the keys (3ed4dfb0b8af012d2fb938ac6f7d89ab) into a comma-separated array and map it to a field and then using a lookup table to do the transofrmation.

In both cases, though, the main problem is that I have found no way to use the full payload as a single text within which I can “search” for something.

 

Can you help me?

 

Thank you
Alberto

 

 

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

7 replies

Userlevel 7
Badge +14

Hi @Alberto D'Amico 

Can you post screenshots showing the DATA OUT from the webhook Zap trigger step so we can see the data in the original format that it is received?

Hi, here is a screen shot as requested.

There are 10-12 Question/answer sections like these.

 

Thank you
A

Userlevel 7
Badge +14

@Alberto D'Amico 

The data for each field is an array object.

Array being the 1

Object being the different key/value pairs. (e.g. UUID, Label)

The UUID and Label look like those go together with the UUID being the internal ID for the Label.

 

How can I put the whole payload of webhook into a single variable to be used later in the parser?

Here’s an approach to try:

 

 

@Troy Tessalone 

Thank you for your solution. I followed it, but I am stuck.

I have a basic Zap with two steps:

  1. Webhook - Catch Hook
  2. Create a Lead in Salesforce. This ignores the fields discussed above and just take the basic personal data, which are in a normal key:value form.

This basic Zap is live and does its job. The webhook “catches” normally. 

Along with this I have created the two Zaps suggested by your solution.

The first one of these (the Zap 1 of your solution) uses as trigger the same Catch Hook as above, but this catches nothing (regardless of whether “my” basic Zap is ON or OFF). So there is nothing to pass to the second Zap. I cannot explain this behavior.

Please note that I am not in control of what is coming to the first hook. I have to rely on data coming (~10 events/day)

 

Thank you
A

 

Userlevel 7
Badge +14

@Alberto D'Amico 

We would need to see screenshots with how your Zap steps are outlined and configured now to have updated context.

Hi @Troy Tessalone, thanks for your support.

Here they are the requested screenshots.

___________________________________________________________________________________________________________

Zap 0 → this is the one currently live and working. The Lead is created, but without the array-like fields. 

Zap 0 - Step 1 → Webhook from external resource

 

Zap 0 Step 2 - Create Lead

___________________________________________________________________________________________________________


Zap 1 → This is the first of the two Zaps from your suggestion. Although it is connected to the same (external) Webhook as the Zap 0, nothing has ever arrived here. Hence all the following steps/Zaps are currently useless.

Zap 1 - Step 1. Same webhook as zap 0 (it must be the same, as I have no control on it)

Zap 1 - Step 2. Post to Zap 2 webhook

__________________________________________________________________________________________________________

Zap 2 - This is the second Zap from your suggestion. It should receive the raw payload from Zap 1 and do the needed operations on the payload

Zap 2 - Step 1 - Webhook from Zap 1

 

From here on, there will be operations on payload, and at the end a create lead step as in Zap 0, but since I have received no payload so far, I have to write them yet.

 

Thank you

A

 

Userlevel 7
Badge +14

@Alberto D'Amico 

Each Zap that uses a Webhook trigger has a unique webhook URL.

Help articles for using Webhooks in Zaps: https://zapier.com/apps/webhook/help