Sunday, 2 April 2017

how to trigger refresh page with webhook

I am working with Express, Node, Plaid API, and Plaid's webhooks. I created a POST route to receive the webhook, like this :

router.post('/hook', controller.gotHook)

I am receiving a webhook req, and I am able to log it out. However I am having trouble triggering anything in my own application after receiving the webhook.

I think the issue is that since the Request is being POSTed from Plaid, not not my app, the res is not being read by my app.

controller.gotHook looks like this

export function gotHook(req, res, next) {   
        console.log("THIS BE HOOKS!!!!", req.body) 
        res.redirect(req.get('referer'));
       }

I think the res is not directed at my app, but instead it sends a res response back to Plaid API. I want to be able to receive a webhook, and update a component to show the newly fetched data in my app.

This is my first time working with webhooks. So please let me know if I misunderstood anything. If you need any additional information to diagnose, please let me know! Thank you!



via Richao

No comments:

Post a Comment