Best answer

Webhook and custom get request


Userlevel 2

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

icon

Best answer by ikbelkirasan 4 July 2020, 18:17

View original

5 replies

Userlevel 7
Badge +11

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

Userlevel 2

Thanks @ikbelkirasan ,

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

Great.

Userlevel 2

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

Userlevel 7
Badge +11

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

output = [{
payload
}]

 

Userlevel 2

Such an idiot.

Thanks @ikbelkirasan 

Everything is fine.

Reply