Skip to main content
Best answer

Webhook and custom get request

  • July 4, 2020
  • 5 replies
  • 534 views

Hi !

This is nice on a webhook. But how could I do the same with a custom get request ?

My workflow is : 

  • Webhook
  • POST on api to get a Bearer
  • GET to retrieve Data
  • Send raw data to another solution.

I can not do the last step as I can’t find a solution to retrieve raw body from the 3rd step.

Do you have a solution ?

Thanks

Best answer by ikbelkirasan

@Tchinkatchuk - You might want to consider using a Code by Zapier step to perform the GET request. This will allow you to retrieve the raw body in the same code step. e.g.

const payload = await fetch("https://...").then((response) => response.json());

payload will contain the JSON payload returned from the GET request.

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

5 replies

ikbelkirasan
Forum|alt.badge.img+12
  • Zapier Solution Partner
  • Answer
  • July 4, 2020

@Tchinkatchuk - You might want to consider using a Code by Zapier step to perform the GET request. This will allow you to retrieve the raw body in the same code step. e.g.

const payload = await fetch("https://...").then((response) => response.json());

payload will contain the JSON payload returned from the GET request.


  • Author
  • Beginner
  • July 5, 2020

Thanks @ikbelkirasan ,

I’ll try the fetch with bearer from the previous step. This should work.

Great.


  • Author
  • Beginner
  • July 6, 2020

Hi @ikbelkirasan ,

I succeed in getting the payload but do you confirm that this payload will not be available in another step ?

My payload keys are dynamic and I can’t set a static mapping on my next step.

Sylvain


ikbelkirasan
Forum|alt.badge.img+12
  • Zapier Solution Partner
  • July 6, 2020

@Tchinkatchuk - If you want the payload to be available in the next steps then simply add it to the code step output.

output = [{
payload
}]

 


  • Author
  • Beginner
  • July 6, 2020

Such an idiot.

Thanks @ikbelkirasan 

Everything is fine.