Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Using Postgres as a Cron Server (supabase.io)
11 points by kiwicopple on March 8, 2021 | hide | past | favorite | 1 comment


Hey all, this was a request from a developer on our platform who needed to send a webhook every day. The tl;dr:

    create extension if not exists pg_cron;
    create extension if not exists http;

    select
    cron.schedule(
        'webhook-every-minute', 
        '* * * * *', 
        $$ 
        select status
        from
        http_post(
            'https://some.site/your-url',
            '{"hello": "world"}',
            'application/json'
        )
        $$
    );
This sends a POST request to a URL every minute.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: