Possibility of missed webhooks

(Michael Schultz) #1

I’m using Dwolla OAuth+Send to enable my customers to pay me. I’m doing:

  1. Send user to OAuth, get ‘authorization code’
  2. Exchange code for access/refresh tokens.
  3. initiate ‘send’ Transaction.
  4. As a result of step 3, i get a transactionId, which I write to my db with the transaction’s details.
  5. When the webhook is triggered, it contains the transactionId, allowing me to update the db row corresponding to that transaction.

Problem is, its possible for the db write in step 4 to take a while (db contention, or other delays). That creates the possibility that the webhook could trigger before the row is safely written to the db. The webhook code would then see a transactionId that has no corresponding row in the db, and exit.

This seems to be either a design flaw in the API, or maybe I’m just using it wrong. Any ideas?

(Spencer Hunter) #2

@Michael_Schultz, This is something that you’ll need to take into consideration as you are designing your app and integrating with Dwolla.(I also think you’ll run into this with any third party API that has webhooks)

Regardless of the tool you use, the recommendation for handling volume and lengthy processes will be sending the webhook data to another back-end service somewhere. i.e. It may be wise to push the webhook payload onto your own work queue solution to be processed. 1) Read and validate the data from the webhook request 2) publish a message to something like RabbitMQ 3) send a “200 OK” to Dwolla indicating the webhook request was accepted.