Safely screen requests to pages/api for cron jobs with Vercel
So I've setup my app using create-t3-app and am trying to using vercel cron jobs to send out emails every so often.
Basic structure would be to setup pages/api/cron.ts to call a function in server/api/sendEmails.ts. But how do I ensure that not anybody can just send a request to cron.ts and fire off an email blast?
I have a couple of webhook endpoints in "pages/api" that verify the source of the request for either stripe or clerk using functions provided by each service, but I'm unsure how to do something like that on my own.
Any tips/suggestions on if this is even the right approach?
Basic structure would be to setup pages/api/cron.ts to call a function in server/api/sendEmails.ts. But how do I ensure that not anybody can just send a request to cron.ts and fire off an email blast?
I have a couple of webhook endpoints in "pages/api" that verify the source of the request for either stripe or clerk using functions provided by each service, but I'm unsure how to do something like that on my own.
Any tips/suggestions on if this is even the right approach?