Problem with send_at parameter

hi, i have a problem with send_at parameter in send message endpoint.
i need to provide it to use send_success and send_failed webhooks for a message.
in c# i have a code like:

SendAt = DateTimeOffset.UtcNow.AddSeconds(5).ToUnixTimeSeconds();

but i get error with message “provided send_at field is less than current epoch time”
when i increase SendAt to 2 minutes it works

SendAt = DateTimeOffset.UtcNow.AddMinutes(2).ToUnixTimeSeconds();

am i doing something wrong? or is it possible to use these webhooks without this parameter?

Hello @bartosz.grzeda,

I just tested using Ruby and you’re right…2 minutes is the minimum you need to pass in order for SendAt to work. Not sure why, must be reliability reasons.

Anyways, SendAt is not a mandatory field, so you can simply ignore it…

In this code samples (and ignore my C# ignorance :sweat_smile:) I’m sending an email without SendAt (this should trigger the webhook as well)

ok, thanks. i will try without this parameter

unlukcly, seems like these webhooks are not working without sending a message with send_at parameter

I wrote a blog post called How to create and read Webhooks with PHP, Koyeb and Bruno which deals with Email Webhooks. You might be missing something, as webhooks are getting generated for each email without the need of SendAt.

are you sure about message.send_success and message.send_failed webhooks?
documentation says like

You must set the send_at parameter in an email message to use this webhook trigger.

Oh, so sorry :disappointed: You’re right, I haven’t used those kind of webhooks yet, so I got confused. Will ask engineer about the 2 minutes timeframe and get back to you…

@bartosz.grzeda Here’s the reply from the Eng team

those webhooks are only needed for scheduled send since the operation is asynchronous. E.g. hey send this message in the future and let me know if it is successful or fails.
For immediate send, the operation is synchronous, so the API response and status code indicate if request was successful.