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);
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");
Upstash-Timeout
import { Client } from "@upstash/qstash"; const client = new Client({ token: "<QSTASH_TOKEN>" }); await client.schedules.create({ url: "https://my-api...", cron: "* * * * *", timeout: "30" // 30 seconds timeout });
import { Client } from "@upstash/qstash"; const client = new Client({ token: "<QSTASH_TOKEN>" }); const scheduleId = "my-schedule" // pause schedule await client.schedules.pause({ schedule: scheduleId }); // check if paused const result = await client.schedules.get(scheduleId); console.log(getResult.isPaused) // prints true // resume schedule await client.schedules.resume({ schedule: scheduleId });
Was this page helpful?