Best answer

Need help extracting data from webhook

  • 8 April 2022
  • 6 replies
  • 454 views

Hello all,

 

I am trying to figure out how to extract regular data from a webhook through Zapier. Here’s a snip of the payload as it comes in:

message:

    type: message

    text:

*Order-Form* submission from <user> *Item * Server Warranty Renewal *Company * Test Company

 

I started messing around in Code but can’t get the js to run and do what I need. Normally, I’d just be able to pull the values or pick off a child key, but it seems like I’ll need some sort of coding with this since my two items I need are nested under “text”. The text after “item” and the text after “company” are going to be different every time. I would need to extract those values every time. This is where I am completely stuck. Any help would be greatly appreciated! :) 

icon

Best answer by Troy Tessalone 11 April 2022, 20:14

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.

6 replies

Userlevel 7
Badge +14

Hi @litech 

Good question.

Check out this related help topic:

 

Hey Troy,

 

Appreciate the response. Seems like this is working, but for the first variable it’s returning: 

Item: Server Warranty Renewal *Company * Test Company

 

The Company: Test Company comes up on its own line properly, but I can’t figure out how to trim the Item: so it ends right after “renewal”

 

Thank you so much for the help. 

Userlevel 7
Badge +14

@litech 

You’ll need to split the start and split the end.

You can define the first segment before the split value with .split(‘VALUE’)[0] and the second segment after the split value with .split(‘VALUE’)[1].

You can use .trim() to remove whitespace.

You are awesome. Thank you so much, Troy! 

Hi Troy, can I ask something about getting an error to Zapier using POST action event which I was trying to integrate Zapier to a CRM using Webhook. This is the warning I always get

 

 

Userlevel 7
Badge +14

Hi @peter_1998 

Please post that as a new Zapier Community topic, thanks.