Wait Node with a function in Specified Time

Describe the problem/error/question

I’m trying to send an HTTP request 1 hour before a date and time that I receive in a webhook. I’m transforming it to ISO format, but it’s not working. I don’t know why.

What is the error message (if any)?

No erro message. The workflow just keep going forever until i stop.

Please share your workflow

I’m leving here the test that i’m making because the error is the same.

Share the output returned by the last node

The node just wait forever and does nothing

Information on your n8n setup

  • n8n version:
    1.31.1
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

hello @Coders_Club

What does it mean? You can’t send anything in the past…

Can you share the workflow?

The date that I receive in the webhook is the date of a scheduled call, and I want to remind the participants 1 hour before the call.

In the test I’m sharing, I picked the current date and added 1 minute to test and still no working.

In that case, the webhook must receive that data earlier than 1 hour before the call. E.g. receive it 1 hour 10 minutes before the call, wait for 10 minutes and send a reminder.

To share the workflow, select all nodes (or hit ctrl+a), then past the content here after clicking the button </>
image

Workflow for tests, that will remind 2 minutes before the call. To check - open the https://www.unixtimestamp.com/ and create a conversion, that will be in 3-4 minutes

Click on the red text below the workflow and hit “Copy”, then ctrl+v in the workflow window to past it

1 Like

That is what i was doing:

Your way works but why my way dont work?

Because the Wait node works with seconds (or other measurable time entity), it does not work with timestamps.

That formula

{{ $json.DataHoraNova.seconds -3600}}

will evaluate the date and substitute an hour from it (in theory). Thus, it will return a new date (e.g. 2024-03-12T20:33:38+01:00), but the Wait node can’t work with it, the date will be treated as a timestamp (e.g. 1710276600, so it waits for that amount of seconds. It’s about ~55 years to wait :slight_smile: )

You should provide the number of seconds to Wait for (e.g. 10 - wait for 10 seconds only) or you have to change the operation to “At Specified Time”.
image

But for that, your date should be converted into date type

{{ DateTime.fromISO($json.DataHoraNova).minus({ "seconds": 3600 })}}

First of all, you are helping me a lot, so thanks a lot.
Secondly, actually I sent the wrong workflow that I was testing. I was doing what you said with ‘Specified Time’, but it still doesn’t work.

I tried with node code too but I’m still missing the point somewhere. Again, thanks a lot.

I think is the brazilian format of date

Hm… It’s acting very weird with that action and an expression as a value.
It will work only with the date in the below format (see the workflow in the end):

{{ DateTime.fromISO($json.DataIso).toFormat("yyyy-MM-dd'T'TT") }}

Moreover, that flow has an internal error with the dates

@Jon can you check this out? Seems the Wait node has not been designed for such a case.
Error says

And if I set the date with an expression in the same format, than it seems everything is working fine, except in the executions we will see some weird waiting time
image

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.