Question

How to setup and use REST hooks?


I have an API registered as a subscription, but I don't know how it works
i create zap and i get webhook url for my app

 

how to use the webhook?

  • I call the webhook with parameters. and I test trigger in zapier editor, it works.
  • i checked my API log, no one is calling it

 

i read some references, my API will get hookUrl. how do i get this hookUrl? when is my API triggered?


15 replies

Webhook subscriptions are interactions (usually one-way transmissions) between an origin and a target. 

 

When the origin has data to send, it needs to know where to send it. This is set up via an initial registration with the origin API, typically a POST including authentication, data format, filters / specifications, and target URL.

In this case, the target URL your zapier webhook url provided in the ‘set up trigger’ step. 

The POST request to set up your subscription varies by API. Refer to origin documentation for instructions and code examples. 

 

Typically the POST will include:

Origin URL for subscription https://appxyz.com/api/1.0/webhooks

Headers:

Authentication: ften a bearer token

Content-Type: application/json (zapier required)

Parameters: target (webhook URL from zapier), filters / specifications, other specifics requested / required by origin.

 

Zapier hook triggers don’t have a mechanism to do this on their own, so you’ll need to register the hooks with a 3rd party application. I personally use Postman for this, but there are countless options.

 

If you include the origin app / service and info about the end goal of your zap, I’m sure the community can provide better direction.

Hope this helps!

thank you for helping me @zaptastic 
i set my API in zapier integration like this

for now I still haven't set Unsubscribe and Perform List

set trigger in zapier editor, dan i get webhook url

Before I test, I send the data first

you meam like this?

my API process: call webhook url with parameter passed to my API

after that i did a test in zapier editor

what i did is correct?

Userlevel 1
Badge

hi

@Gilar 

Did you able to Implement Rest hooks? because I’m trying to figure out how hookUrl will be send to me beside Postman?

@Brilliant16

 

Set up depends on the service you’re subscribing to. If no handshake is required, I’ve found subscribing with postman & using the target URL easier to troubleshoot and faster than zapier platform. 

If your subscription requires a handshake with a secret, you’ll need to initialize the connection via the ‘subscribe’ step, so the webhook ID and the secret are both passed to zapier.

It’s tricky - I haven’t gotten it working asynchronously yet but it’s certainly scriptable with a sync functions.

 @Gilar looks like your test worked - try passing data from your app and see if it arrives in your zap. If it does, you’re all set. If it doesn’t, more configuration is required.

make sure your ‘perform’ code has [bundle.cleanedRequest] in brackets, otherwise you’ll get an array error. 

Userlevel 1
Badge

@zaptastic 

actually I’m trying to figure out basic part. If you please see this?

 

Yes - when you create a new zap with the trigger app, the ‘subscribe’ code will send a POST to initiate the connection. 
Please take a screenshot or provide more information - I’m not sure I’m answering your question properly. 

Userlevel 1
Badge

I’m expecting, Zapier will call my domain post Url and will send me hookUrl so I can call that hookUrl to post my response.

 

 

But I’m unable to pick a point. when Zapier will call my subscribe url?

Zapier only provides my this hook URL. which I can call from postman to receive a notification.

This post has been edited by a moderator to remove sensitive information. Please remember to obfuscate any personally identifiable information prior to posting as this is a public forum. 

Zapier tests the REST Hook app configuration using a real zap, in this case, “1. New Payment In...”.

The URL under ‘set up webhook’ IS the hook URL for this zap and therefore, the test as well. You would reply to this URL after the subscribe is sent. This URL should also show up in your app when the subscribe is first sent out, shown in code as {{bundle.targetUrl}}

The Subscribe POST is sent as soon as you click ‘create a zap’ (next to monitoring at the bottom of the platform set up page). Go into the monitor (bottom left in platform) to see these log entries. 

 

Just to be thorough - why are you creating a custom app for this process? If your app needs to send data to a webhook in zapier, then pass that data to slack or get formatted, then send to slack, it would be much easier to just use the ‘webhooks by zapier’ pre-configured app.

 

Userlevel 1
Badge

I’ve created and turned on zap but the thing is still this url can not be called? I can not see any log entries of calling this url in my dev environment.

https://72ef-39-42-170-124.ngrok.io/api/zapier/hooks

 

I’m creating the custom app for a web app so users can use this to receive instant trigger (customer/payment ) from web app.

 

Like I’m unable to get response on my url? as I can see nothing happened with this url by zapier.

Userlevel 1
Badge

hey.did you get my point? 

if zapier still isn’t calling your URL on zap creation, you might need the help of someone from Zapier to resolve.

You might try putting the URL as your ‘perform list’ URL to see if that sends data to your environment, at least to test if there’s a connectivity issue. If that works, there’s no reason it isn’t getting through to your environment. I’d switch to the ‘code’ view and take a closer look under the hood and work through some trial and error. 

good luck!

Userlevel 1
Badge

hey I can see the response from ‘perform list’ and also can see the response in my logs and ngrok logs.

 

But subscribe url do not call. while I’ve create 5-8 zaps in last 2-3 hours. 

Userlevel 1
Badge

hi,

It works. Zapier call my subscription url. 

What I did.

I paste a URL in Unsubscribe input field. 

 

so It means both subscription/Unsubscribe url have to set. I didn’t read this anywhere. might be I missed somewhere. 

 

@zaptastic thank you for being with me.  

 

Wow - way to troubleshoot your way through that. Very odd indeed.
I haven’t been successful with some of my rest hook attempts and i think that might be the answer. 
Great work @Brilliant16 - that’s determination. Looking forward to testing this on my end and hopefully getting that patched up or at least added to the documentation - - which is pretty weak on custom rest hooks at the moment.

 

cheers!

 

 

Reply