Best answer

Catch Raw Hook

  • 30 October 2020
  • 2 replies
  • 1196 views

Userlevel 1

I run into an issue and would like to have it resolved.

Here is a raw data that I get:

aw_body

{"01. Milestone":"01. START - Info Form Completed & Document Collection Started","02. Borrower Full Name":"Catch Hook","03. Borrower Email":"catchhook@testing.com","04. Borrower Phone":"","05. Co-Borrower Full Name":"","06. Co-Borrower Email":"","07. Co-Borrower Phone":"","08. Loan Name":"Test",

How do I extract and steralize that?

icon

Best answer by andywingrave 10 November 2020, 18:40

View original

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

2 replies

Userlevel 1

Hey, Thanks for getting back to me!  I was able to resolve it following your advice. Thank you!

Userlevel 7
Badge +9

Hello! Is there a reason you need to catch it as a RAW hook instead of catching a standard Webhook? (Just curious, on this one - If there’s a way to send the data parsed, instead of unparsed, you’ll save yourself this code step...) 

What you’ve sent, if we start to look into it, is part of a JSON payload and you can start to make more sense of it when you’ve formatted it like this:

[{
"01. Milestone": "01. START - Info Form Completed & Document Collection Started",
"02. Borrower Full Name": "Catch Hook",
"03. Borrower Email": "catchhook@testing.com",
"04. Borrower Phone": "",
"05. Co-Borrower Full Name": "",
"06. Co-Borrower Email": "",
"07. Co-Borrower Phone": "",
"08. Loan Name": "Test",

So we can start to see for instance that the Milestone is “01. Start….” 

We need to format this, though - So that Zapier can do something with this JSON...And the easiest way - I believe is to use JSON.parse in a code step...So, like this…

 

 

where…

  1. is the variable name we give to our string
  2. is our string from the previous step (ie. the one you shared with us)
  3. is our code in a JavaScript step:
var output = JSON.parse(inputData.json)

output = [{output}];

Try this first...It may be what you need...And if it’s not, you probably want to just grab the first record in the array, and you can do this like so…

var output = JSON.parse(inputData.json)[0]

output = [{output}];