import { Client } from "@upstash/qstash";
const client = new Client({ token: "<QSTASH_TOKEN>" });
await client.schedules.create({
destination: "https://my-api...",
cron: "*/5 * * * *",
});
import { Client } from "@upstash/qstash";
const client = new Client({ token: "<QSTASH_TOKEN>" });
await client.schedules.create({
destination: "https://my-api...",
cron: "0 * * * *",
callback: "https://my-callback...",
failureCallback: "https://my-failure-callback...",
});
import { Client } from "@upstash/qstash";
const client = new Client({ token: "<QSTASH_TOKEN>" });
await client.schedules.create({
destination: "my-url-group",
cron: "* * * * *",
});
import { Client } from "@upstash/qstash";
const client = new Client({ token: "<QSTASH_TOKEN>" });
const res = await client.schedules.get("scheduleId");
console.log(res.cron);
import { Client } from "@upstash/qstash";
const client = new Client({ token: "<QSTASH_TOKEN>" });
const allSchedules = await client.schedules.list();
console.log(allSchedules);
Note that if a schedule exists with the same id, the old one will be discarded
and new schedule will be used.
import { Client } from "@upstash/qstash";
const client = new Client({ token: "<QSTASH_TOKEN>" });
await client.schedules.create({
destination: "https://example.com",
scheduleId: "USER_PROVIDED_SCHEDULE_ID",
cron: "* * * * *",
});
import { Client } from "@upstash/qstash";
const client = new Client({ token: "<QSTASH_TOKEN>" });
await client.schedules.delete("scheduleId");
import { Client } from "@upstash/qstash";
const client = new Client({ token: "<QSTASH_TOKEN>" });
await client.schedules.create({
url: "https://my-api...",
cron: "* * * * *",
timeout: "30"
});
import { Client } from "@upstash/qstash";
const client = new Client({ token: "<QSTASH_TOKEN>" });
const scheduleId = "my-schedule"
await client.schedules.pause({ schedule: scheduleId });
const result = await client.schedules.get(scheduleId);
console.log(getResult.isPaused)
await client.schedules.resume({ schedule: scheduleId });