HELP! How do you parse webhooks data as number instead of a string
I am trying to send data to an application not currently supported by Zapier via the POST webhooks zap.
Everything works fine except for number fields, which got me thinking…
If i wanted to send data as a string or as a number, how would i distinguish them in the datafields?
eg lets say i wanted Zapier to read ‘duration’ as a string and ‘duration-2’ as a number.
How can i distinguish this in the set up?
My problem is that i need to input a number value but Zapier seems to parse the data as a string.
What can i do to make it read it as a number?
Page 1 / 1
Hi @Strem
Good question.
You can use the WebhooksCustomRequest option to configure the JSON.
I’m actually having some trouble validating headers with custom request, so ideally i’m looking for a solution that does not go down this route. But maybe not possible? Seems strange tho
@Strem
If you’re using POST Request or Custom Request, the Headers section in the Zap step config is the same.
For whatever reason when I test a Zap using Custom Request and i use the exact same Header config as a POST Request, the test fails citing Invalid Headers (HTTP Status Code: 400)
@Strem
We’d need to see updated screenshots with how your Zap step is configured to have context.
Sure.
Here are the two configs. Note the basic required info for this API is simply name and workspaceID, so these are the only elements i am including for now in the CUSTOM REQUEST. But you can see that the Header is the same.
POST REQUEST and Test Result
Here is the CUSTOM REQUEST and Test result.
Headers is the same on both. One passes authorisation and the other doesn’t
@Strem
You need to put double quotes around the fields and values.
“name” : “VARIABLE]”;
“workplaceId” : “VALUE”
Added double quotes to name and value
still getting same Invalid Headers error.
@Strem
Try adding these headers:
Accept: application/json
Content-Type: application/json
You can try testing your API request in Postman, which may provide more context about the error.
Troy, you are a legend! Works! Thanks for being patient and helping solve the issues
This is what I love to see!
@Strem I just wanted to confirm whether you’re now good to go with the Webhook step.
It’s awesome seeing the interaction here, and Troy sure is a legend when it comes to digging into the nitty gritty of Zapier, APIs and code