Skip to main content
Best answer

Send/parse bundle.rawRequest fetched data from triggers to creates


Hello everyone,

We are considering building an zapier integration(cli) and i’m currently building a demo app,but i’m stuck with the following problem:

Our app uses API-KEY authentication and REST Hook trigger,but i when i send some data to the trigger via the webhookURL i want to extract a specific header from that  request which i can in the trigger:

 

const perform = async (z, bundle) => {
#how can i fetch here my desired http-header and parse it to the creates module ? 

bundle.rawRequest.headers[‘Http-My-Header’]

return [bundle.rawRequest];

};


 

but i don’t know how to parse that value to the creates section so that i can send back to my server ? 

Since its not a user input field i would like to avoid using the input fields for that .

Thanks .

Best answer by walter_fluidBest answer by walter_fluid

Hello @MarinaH ,thank you very much for your answer :) 

 

You would not be able to pass that header value on in a separate action as that action’s code would be entirely independent of the request received by a trigger. 

This answered my question,since i was wondering if triggers and creates/actions can share data independent of  inputData with one another.

 

Best regards ,

Walter

 

View original
Did this topic help you find an answer to your question?

2 replies

Forum|alt.badge.img+9
  • Zapier Staff
  • 238 replies
  • July 12, 2024

Hey @walter_fluid 👋

`bundle.rawRequest.headers[‘Http-My-Header’]` would only be expected to give you a value in the `perform` that follows a newly received webhook and uses the request data from the received webhook:

https://github.com/zapier/zapier-platform/blob/main/packages/cli/README.md#bundlerawrequest

You would not be able to pass that header value on in a separate action as that action’s code would be entirely independent of the request received by a trigger. 

I understand from your note you don’t wish to ask the user for the detail you’re looking to include in your request, but this does sounds like a use case for `inputData` configured for that create: https://platform.zapier.com/build/bundle#inputdata

Another option is checking if your authentication uses Oauth or session method, and the value you’re needing in your `creates` could be returned in the test authentication endpoint you choose - as you could then store that in a computed field: https://platform.zapier.com/build/computed-test-field 


  • Author
  • Beginner
  • 1 reply
  • Answer
  • July 23, 2024

Hello @MarinaH ,thank you very much for your answer :) 

 

You would not be able to pass that header value on in a separate action as that action’s code would be entirely independent of the request received by a trigger. 

This answered my question,since i was wondering if triggers and creates/actions can share data independent of  inputData with one another.

 

Best regards ,

Walter