Skip to main content
Question

HELP! How do you parse webhooks data as number instead of a string

  • May 15, 2023
  • 11 replies
  • 653 views

Strem

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? 

 

 

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

11 replies

Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • May 15, 2023

Hi @Strem 

Good question.

You can use the Webhooks Custom Request option to configure the JSON.

 


Strem
  • Author
  • New
  • May 15, 2023

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


Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • May 15, 2023

@Strem 

If you’re using POST Request or Custom Request, the Headers section in the Zap step config is the same.


Strem
  • Author
  • New
  • May 15, 2023

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)


Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • May 15, 2023

@Strem 

We’d need to see updated screenshots with how your Zap step is configured to have context.


Strem
  • Author
  • New
  • May 15, 2023

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 


Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • May 15, 2023

@Strem 

You need to put double quotes around the fields and values.

“name” : “[VARIABLE]”;

“workplaceId” : “VALUE”

 

 


Strem
  • Author
  • New
  • May 15, 2023

Added double quotes to name and value 

still getting same Invalid Headers error. 

 

 

 


Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • May 15, 2023

@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.


Strem
  • Author
  • New
  • May 15, 2023

Troy, you are a legend! Works! Thanks for being patient and helping solve the issues


nicksimard
Forum|alt.badge.img+11
  • Zapier Staff
  • May 17, 2023

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 😀