Question

Webhook array formatting

  • 9 November 2020
  • 6 replies
  • 45 views

Userlevel 1

Hey there! I have a form that a client fills out prior to starting with our company. I use webhooks to grab info from that form to start them an account in a piece of software we use. In the software, I’m able to apply labels to the client based on choices they select. These labels are identified as a 3 or 4 digit number. I have the webhook set up with the selection the client makes (can we use your photos? yes or no), but there are also labels that apply to every client that set things in motion in the software. You can see in the screenshot under the “packages” entry I have already added the choice the client makes. I’d also like to send another 3 digit code every time to add another label. I keep getting errors so I’m not sure how to format this. I want it to essentially be:

 

packages         (1. Do you authorize….etc: 942) , 950 , 960

 

950 and 960 will apply for every client, the first portion will be the result of a choice made on the form. Thanks for decifering this, I’m not fluent in webhook speak :)


6 replies

Userlevel 1

 

Userlevel 7
Badge +6

Hello! I’m not sure I understand the question Please can you send a screenshot of the response you get when you run this zap?

Userlevel 1

Sorry, it’s tough to describe the issue. On the software I’m sending these webhooks to, there are labels or tags that I want applied to each new client that fills out a form. 1 of those tags is variable and is based on a selection the client makes on the form (see above screen shot under “packages”). The value 942 is the numeric indicator for the label on the software. The other 2 labels I want applied are always the same for everyone so I want to indicate the numeric value to tell the software to apply those labels as well. I don’t know if I should use a comma to separate the choice and then the hard typed numberic values? I’ve attached a screenshot showing the way I’ve tested it and the error I get back. Thanks!

942 is the result of a choice on form, 1062 applies to every client so I have just typed it.

 

Userlevel 7
Badge +6

So the first thing I see here, is that it’s expecting an integer when you are sending a string. Have you tried sending as a single number?

If that works - That will help you identify the problem, but not the solution.

If your aim is to add these values which are the same for every object - you’ll need to figure out what the key is for these. All three can’t be “packages” if packages is expecting an integer. 

Userlevel 1

Ok I have more detail explained in a better way. One of the developers of the software has been helping me but he’s also unsure exactly how Zapier wants it to be formatted. His reply to this is below:

 

I checked the logs, but unfortunately that's not the issue.  What's happening is the value is coming through as a single string "942, 1062", which is not parsable as an array.  I see the question, and put together a response with some specific wording below that you can use.  If this comment doesn't give a good solution (or if you'd just prefer to try something else), we can try the 'custom request' approach as noted at https://stackoverflow.com/questions/43161861/zapier-webhooks-posting-json-array

 

You can see in the screenshot I am passing a value for "client__gender".  This is a json object where "client" is an object that contains an object called "gender" like:
{
    "client": {
        "gender": "VALUE"
    }
}

In this case, two underscores allow me to define the child object.  However, what I'm looking to do is something similar but for arrays.  In this case, the array is titled "packages" and the JSON would look like this:
{
    "packages": [
        "942",
        "1062"
    ]
}

Specifically, I want to pass the "942" and "1062" values inside an array.  How do I properly denote the "942" and "1062" are array entries for the key "packages"?

Userlevel 7
Badge +6

Can you ask your developer if this thread helps - It seems to be a similar problem to @Paul’s previous thread, here: 

 

Reply