Skip to main content
Best answer

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

  • 1 July 2024
  • 2 replies
  • 41 views

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.headersh‘Http-My-Header’]

return rbundle.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 .

2 replies

Userlevel 4
Badge +9

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 

Userlevel 1

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

 

Reply