Closed nik-lampe closed 1 month ago
Refetching the contact on every event trigger is quite costly on the database.
I suggest we move this to the contacts controller's subscribe and unsubscribe routes!
Try to use the ContactService.id()
method after clearing the Redis key for the contact as this function will automatically cache the updated value as well!
Good point. I have updated the PR. The contact passed to the action service is now the updated object returned from the update call.
Looks great!
Please upgrade the version in the main package.json
to 1.0.5
and I will merge it in for you.
Thank you for your contribution :)
Done 👍
This refetches the contact after triggers ran, so that marketing templates can be sent on actions triggered by the
subscribe
event. Otherwise the subscribe flag might still be false, because the contact has just subscribed and the entity is in a stale state and thus the template is not sent.