Skip to main content
Best answer

Send the info about the Zap as part of rest hook subscription call

  • November 9, 2019
  • 5 replies
  • 3536 views

Vinit_Agrawal

In my Zapier App, I am call the resthook API hosted on my app's server to pass on the bundle.targetUrl webhook URL where the data can be reported and trigger the app.

I want to send more information, as part of this resthook API call. Things like which action app is used as part of this Zap, what all fields have been mapped in the action app, which of them is required etc.

I want this so that I can configure my app more precisely to decide when exactly to report the data and trigger the Zap.

I think the answer to this question is in the bundle variable. But I am not able to find the exact structure of this variable what all data does it hold and if it holds other data about the Zap mentioned above.


For reference this is the current code for subscribeHook function in my app:

```

const subscribeHook = (z, bundle) => {

 const data = {

  url: bundle.targetUrl,

  event: ['new_conversation'],

 };


 // You can build requests and our client will helpfully inject all the variables

 // you need to complete. You can also register middleware to control this.

 const options = {

  url: `${_sharedBaseUrl}/api/v1/convbot/${bundle.inputData.chatbot}/resthook`,

  method: 'POST',

  json: data,

 };

  

 return z.request(options)

  .then((response) => JSON.parse(response.content));

};

```


Best answer by matthewBest answer by matthew

We don't offer an API that exposes this information for apps that use REST Hooks — and it's not currently on our roadmap to offer such an API or expand the information that we give to apps for the purposes of REST Hook registration.

That said, I've gone ahead and added this to our internal product database just so the developer platform product team are aware of the level of interest in having such an API and/or exposing more information to developers. I can't make any specific promises but we'd post about this publicly in the event we decide to develop this further.


View original
Did this topic help you find an answer to your question?
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 Expert
  • 555 replies
  • November 9, 2019

As far as I know, that's not possible. You can't get information about the zap running your app from the bundle object. However, you can get the Zap ID from bundle.meta.zap.id which is available in performSubscribe and performUnsubscribe methods.

For reference, you can find more information about the content of bundle in the documentation here https://github.com/zapier/zapier-platform/tree/master/packages/cli#bundle-object




Vinit_Agrawal

Thanks @ikbelkirasan for you response.

Do you know, what kind of information I can fetch from the Zap_ID?

If I can get the above information from Zapier on a separate API call, using Zap_ID, that will work for me.


Thanks

Vinit



ikbelkirasan
Forum|alt.badge.img+12
  • Zapier Expert
  • 555 replies
  • November 10, 2019

@Vinit_Agrawal I'm afraid that's not possible. Unfortunately, Zapier doesn't have an API that can be used for that.



ChrisP
Forum|alt.badge.img
  • Connector
  • 79 replies
  • November 14, 2019

Zapier Manager native app offers "Search Zap by ID" and then will return more info on that zap:

-----------------

zap_link

https://zapier.com/app/editor/1

last_live_at

2018-04-19T19:39:28+00:00

last_paused_at

2018-04-19T19:34:26+00:00

title

My Awesome Zap

root_id

1

paused

false

state

on

task_history_link

https://zapier.com/app/history?root_id=1

last_edited_by

contact@zapier.com

-------------------------------------

However the current fields don't provide the info you're looking (which apps used etc.) There have been a lot of requests for the Zapier Manager app to include more granular info, and if this comes about could be used in your use-case.



matthew
  • Zapier Staff
  • 10 replies
  • Answer
  • November 15, 2019

We don't offer an API that exposes this information for apps that use REST Hooks — and it's not currently on our roadmap to offer such an API or expand the information that we give to apps for the purposes of REST Hook registration.

That said, I've gone ahead and added this to our internal product database just so the developer platform product team are aware of the level of interest in having such an API and/or exposing more information to developers. I can't make any specific promises but we'd post about this publicly in the event we decide to develop this further.