Handling Duplicate Events


Here is what my app (Nodejs) is currently doing, and the assumptions I am making. Please verify if it is possible to continue with this set-up.

Also, can any other events, beside transfers, be duplicated?


The short version is that my app is storing resourceIDs, and that it seems like there is a scenario where that could work, instead of using eventIDs, as suggested in this link (step B):


  1. Initiates transfers, and on callback, persist the sender, receiver and resourceID.
    -I assume that there is a single response for the callback. To me, it does not matter if the resourceID within the response is associated with the sender or receiver.
  2. On transfer webhook events, only act on the event if the resouceID is in the database.

I finally got around to testing this. It turns out that, in order to prevent acting on duplicated webhooks (because dwolla can send the same event for each accountID involved), you can also use resourceIDs the same way the docs suggest to use eventIDs. That is, you can persist the event topic (i.e. transfer_created) along with the resourceID as a record that you already processed this.
My train of thought was that eventIDs were the only IDs that would be the same between duplicated events. It turns out that resourceIDs are also duplicated. I like using resourceIDs because they are also sent in the transfer callback response.


If I may get to the core of my question:


This part of the documentation says that a response will look like this:
.post(‘transfers’, requestBody)
.then(res => res.headers.get(‘location’)); // => ‘https://api.dwolla.com/transfers/74c9129b-d14a-e511-80da-0aa34a9b2388

That link has a resourceID. right?
But, then I should expect two webhooks, with two different resourceIDs?
If so, which resourceID am I getting in the response header above?


EDIT: The transfer callback response has the resourceID indeed. When the transfer webhooks come in, one for the sender and receiver, they will both have the same resourceID. They will also have the same eventID. You can store either to make sure that you don’t act on the same event twice. (i.e. sending an email to both users about the details of the transfer.)

(Cory Anderson) #3

(Cory Anderson) #4

(Cory Anderson) #5