Email notification when message was not read within an hour

Hey guys,

so I’ve build simple messenger into my app. What I need is simple email notification if the new message was not read by the recipient within an hour or two. I do have type field “read by” on the Message DT that is updated when the recipient reads the message.

Now, I tried scheduling API with the conditional “only when the Messages Read by doesn’t contain the recipient”. This do not work, as If I understand correctly because “action properties are evaluated for conditions before a workflow is executed” (see below)

Any tips on this? Sending email every time someone sent a new message is ridiculous.

I’m sure there is nice clean way to do this

[edit]

What comes to mind is canceling scheduled workflow… When the user reads the message → cancel scheduled workflow related to this message. :thinking:

It should work.

You should have an endpoint scheduled for current date time + 1 or 2 hours.
If current workflows thing’s “read” = yes - the workflow will automatically terminate itself.

If read = no, the email will get sent

1 Like

Hi @bartek.dev

You shouldn’t apply the condition on the “schedule API workflow” action but on the targeted workflow itself.

Like you said the condition of the “Schedule API workflow” is evaluated before scheduling it. What you should do is removing this condition so that the Workflow will always been scheduled in the coming hours and then put the condition in the action “Send email” inside the backend workflow. In this case, the workflow will be executed but no email will be sent if the message has been read by the user.

Best,

Arthur

2 Likes

Thanks @jordanfaucet @arthur.kieffer

I just double checked and you are right it works.

I don’t know why it didn’t work when I tried it the first time. I have setup the conditionals again and work it works so the conditionals ARE NOT evaluated before the workflow is scheduled but when the workflow is executed which is great.

@arthur.kieffer yes, you are right but I did not made that mistake. The conditionals doesn’t have to be action specific (send email). It can be set to the API workflow but in the backend. Just tested it.

Thanks guys!

2 Likes