Question

Pass entire Trigger response body to Create Action POST body in a Zap

  • 7 October 2022
  • 7 replies
  • 881 views

Userlevel 1

Hi, I'm trying to pass some data from an existing 3rd party Trigger into a new Create Action.

The data from the Trigger is a complex, deeply nested object including some arrays of objects. Some Trigger data includes more fields than others. I'd like to just pass the entire object through to the body of my Action rather than try to deal with all the different mapping cases and trying to flatten the object. Can someone point me to some documentation that could help me get this done?


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

7 replies

Userlevel 7
Badge +9

Hi @balqreports 

You need to use Webhook by Zapier as a trigger and it will provide a webhook URL where you can pass the JSON POST request. Initially during test send the full schema of your JSON and you can map the data to your action steps. 

Userlevel 1

@robschmidt Thanks. I'm not sure this works for me.

I'm trying to consume data from an existing 3rd party Trigger using a Zap. They don't have an API so I can't access their data using Webhooks by Zapier, instead they have a pre-build Trigger I can connect to an Action.

Userlevel 4
Badge +7

Hey there @balqreports ,

I am sorry to say that unless that specific App and Trigger combination you are using provides you a single key that contains all of the data from your trigger endpoint, there isn’t an easy way to tell Zapier to “Send Everything” into a different action.

Since the data object changes between trigger events, using our editor to map every possible version of every field found in the record wouldn’t be possible to do in an easy way either.

In the end the best thing you can do to get this working, aside from pulling in individual trigger samples and mapping each field from each single version that may exist, would be to use our Developers Platform and make your own custom app for this service -- that would give you the ability to send any and all data we fetch from an endpoint to your specification.

Userlevel 1

@RALaBarge I'm using the developer platform to build the new Create Action.

Can you direct me to some documentation that would show how this can be built in a way that would allow me to "send any and all data we fetch from an endpoint to your specification" ?

Userlevel 4
Badge +7

Hey again @balqreports !

Excellent to hear!  There is so much you can do if you roll your own app.  The documentation we link to from the Dev platform is the best source of knowledge to refer to in this: https://platform.zapier.com/docs/zapier-intro

That, in combination with the API reference from the app you are using, would be the documentation needed to move forward.  You would need to start with handling the authentication prior to adding triggers or actions and our documentation does cover all of that.  Our Dev Platform attempts to simplify how complex these types of interactions can be with templates in the CLI app or the web-based editor.

As far as exactly how to go from A to B in your workflow, admittedly there are more steps than “just create a dev app and send everything”: you likely would need to use the `afterHTTP` functions mentioned in the documentation to concatenate the data being returned into a single field which you can return with the rest of the data we send to the Zap when a workflow is running.   You can find more explicit details about this in my first link above in this message.

Zapier does offer some support to folks making custom apps and you can reach out for that when you are getting going here: http://zapier.com/contact-us

We also certify “Experts” which you will see in our community helping other folks.  You could leverage their resources to have them build out an app for you if you would like to save the time: https://zapier.com/experts/

 

Hopefully this gives you something to check out, let me know if you had more Qs! 

Userlevel 1

@RALaBarge I can't seem to locate any reference to afterHTTP in any of your documentation, can you provide a link directly to this area?

I also get the impression for your requirement for an "API reference from the app you are using" that you might be directing me to some documentation to create a new Trigger that would access an external API where I could retrieve or have the data pushed. To be clear, I'm attempting to consume the data from an existing 3rd party Trigger. The service provider has no public API, and so I can't connect direct to them. They do, however, provide a pre-configured Trigger in Zapier I'm attempting to integrate with.

I can apply any configuration required for the Action, I'd like to configure my action to consume the entire body of this pre-configured Trigger (for example, in the Action -> API Configuration -> Configure Your API Request step, when I select "Switch to Code Mode" maybe there's a variable I can append into my options, such as bundle.triggerOutputData or something?)

Userlevel 4
Badge +7

Hey again @balqreports !

Ahh I see -- yes access to their API documentation is required in order to do this.  Without, I am afraid making an app on Zapier would not be possible.  At this time, Zapier does not allow folks to take an app we have created already and edit it to do what you wish here.
Also, apologies for getting my terms mixed up: `beforeRequest` and `afterResponse` were the functions I was thinking of -- these allow you to run custom code to modify the output before it gets returned to Zapier.  Our documentation does not allow us to link directly to that for whatever reason, so if you search for those terms on the search bar top right https://platform.zapier.com/ , it will give you the most context that we have on that.

That said, without access to their API documentation, I am afraid it is all a bit moot.  Have you tried connecting with them via Email to request access to that?  It is worth as shot!