Friday 31 January 2020

How to send information back to the Front end, AFTER functions triggered by a webhook are ran?

Lets just say I have a react front end, a node server/Postgress db, and a third party API that I'm getting data from to put into that db. I have an endpoint that lets me know when data is ready to retrieve, which in turn triggers a function to retrieve that data and insert it into my db, but how do I let my other endpoints/server know that insertion has completed?Like lets just say that ideally, after the webhook has been sent and the data has been retrieved, I'd like my React front end to hit a different endpoint(getTransactions) to get that freshly inserted data. How would I make sure that endpoint is hit after the webhook does its thing?If I use res.send on the /webhook endpoint that just goes to the third party API so the React front end doesn't have a way to know when its done that way. Is there away for my /getTransactions endpoint to wait for the database functions inside my /webhooks endpoint to finish before doing its thing?

Submitted January 31, 2020 at 07:40AM by Bruh_Reefion

No comments:

Post a Comment