Handling Duplicate Events


#1

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?

Thanks.

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):

https://developers.dwolla.com/guides/webhooks/validating-webhooks.html

  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.

EDIT :
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.


#2

If I may get to the core of my question:

https://docsv2.dwolla.com/transfer/#initiate-a-transfer

This part of the documentation says that a response will look like this:
accountToken
.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?

Thanks.

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