Once you create a webhook subscription by making a POST request to /webhook-subscriptions (which it sounds like you already did), webhooks will be sent to the URL you specified without having to create a new subscription each time.
Our webhooks guide has some info on how to handle the webhooks on your end. If you have any questions after reading that, please let us know!
Can you please let me know how we get response on specified web hook URL?
Do we need to call Dwolla API again or just get response in POST Method?
Thanks,
spencer
(Spencer Hunter - Lead Developer Advocate @ Dwolla)
4
@Developer_Crystal, You’ll simply set up a webhook handler that is tasked with responding to the request from Dwolla and processing the POSTed data sent from Dwolla.
Make sure that your app listens to port 80 for http or port 443 for https.
Make sure the endpoint does not result in a redirect. For example, a request on my site that looks like this: http://mypage.com/coolEndpoint
redirects to: https://www.mypage.com/coolEndpoint <-This one should be used for your webhook if you have a similar situation
Here is a sample code in nodejs:
//from the docs…
//this creates the web hook subscription, so that the webhooks get sent to coolEndpoint
//you can use the location to list webhooks (if you have to), among other things
var createWHSubReqBody = {
url: ‘https://www.mypage.com/coolEndpoint’,
secret: ‘best secret of all time’
};
applicationToken
.post(‘webhook-subscriptions’, createWHSubReqBody )
.then(res => res.headers.get(‘location’)); // => ‘https://api-sandbox.dwolla.com/webhook-subscriptions/5af4c10a-f6de-4ac8-840d-42cb65454216’
//once the subscription is created, dwolla will send webhooks to this endpoint, via post request
//you must respond within 20 seconds with a 2XX status
//for nodejs you must also add bodyparser //req.headers and req.body should have what you need
app.post(’/coolEndpoint’, function(req, res) {
//after processing webhook inside req
res.sendStatus(200);
});