#How to trigger function periodically and dynamically?
1 messages · Page 1 of 1 (latest)
🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord
🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize
✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)
are you using vercel? then I would use vercel cron jobs if not inngest could work as well @crude spade
basically you set up an API route check the env var got the cron secret if valid then do something on the server ie your function, then theres a vercel.json that points to the route and sets when it should be triggered. Read those docs and ask me any questions.
But cron jobs only for the static interval. What about custom interval or specific datetime?
Cron jobs allow you to select what time and what day to trigger you could do like everyday at 2:00 p.m. or Monday at 6:00 p.m.
Or you could do like every 22nd
@crude spade
Like I have a cron job that checks user settings every day at 6 am if user settings and sends out a report of hours clocked in if applicable
the chart can cover a specific date and time, but if you want something like event happens, trigger function a, then sleep for 2 days, then function b then sleep for 1 week then send welcome email, you would be better served using vercel work flows
Best way to so it is if the time or date is fixed then use cron job, if the time happens after an event use workflows and sleep, I would bet money you could even check a db with work flows and use a custom sleep time inbtween steps