fixthestatusquo / proca-server

Proca server, SDKs and services
https://proca.app
5 stars 3 forks source link

Trust microservice - confirm reminder service #166

Open marcinkoziej opened 2 years ago

marcinkoziej commented 2 years ago
tttp commented 2 years ago

Hi,

might be good to have a quick chat, my concern on the design: is there a way to avoid having to store PII in a separate datastore outside of proca-server?

ie, what about:

we have two proca api:

lastly, I'd prefer sqlite than levelDB, but it's probably because I'm not familiar with the second (eg is this easy to install? known pitfalls?)

tttp commented 2 years ago

how would the bounce handling fit in the picture here? eg, is there a way to avoid sending reminders to emails that hard bounced/blocked/flagged spam?

marcinkoziej commented 2 years ago

In cases we want to use the repeater for Campax case (open-action: register, close-action: signature) we would have to re-queue register actions (to send the email again) but proca already dropped email from the supporter (privacy feature).

So perhaps here using encryption should be used - then the service would store only encrypted payload and repeat it.

Another problem with how to design this api to requeue only once? If i do status=confirming AND inserte_at < now - x days, it will be TRUE for all moments after exact 2 days....

tttp commented 2 years ago

ok, may be we need to say we can't send reminders if encryption is on/that they need to remove encryption if they want us to send reminder?

I mean, to send an email you need to have the email of the recipient in clear, there

(v2: encrypt at another time than signature, eg if inserted_at < x days ie. it's plaintext when hot and encrypted at rest)

design the api: good point: we need to give a date range, not a max date

if status = confirming and insert date between [start, end].

marcinkoziej commented 2 years ago

Using a service to reque also gives some more control over where the action ends up, for example, when we have Sync + Thank You on delivery exchange, you can make a mistake and re-queue messages to sync them, but also re-send all the thank you emails (this was precisely the fuckup on T4F german partner). With a separete script, you can be more precise and just insert action to Thank you queue. The confirmation queue actually does not have any other action bound to it except sending emails (no other use case)..

marcinkoziej commented 2 years ago

design the api: good point: we need to give a date range, not a max date

if you run this api twice, within the range, you will send emails twice. how do you make sure you run it only once a day? (reliably)

Mitigation for now

The repeater worker should remove PII from contact.* before storing to leveldb - just leave contactRef, firstName and email. Other PII is not used by the confirmation sender, so we can requeue without it.

Problem solved without any big architecture change.

marcinkoziej commented 2 years ago

Or I can add api:

requeueAction(ids: [123], queue: EMAIL) { count }

marcinkoziej commented 2 years ago

@1v4n4 please start working on this, you can start building this app (leveldb, and mechanism to listen on both queues, etc) until we finalize whether action should be stored+inserted, or a api call made to requeueAction()