All skills
upstash avatar

/upstash-qstash-js

@36daab8
by upstashupstash/skills27 stars
7

Work with the @upstash/qstash TypeScript/JavaScript SDK, an HTTP-based message queue, task scheduler, and background job system for serverless and edge runtimes (Next.js, Vercel, Cloudflare Workers, Deno, Node.js). Use when publishing messages to HTTP endpoints or URL groups, running background jobs without a long-running worker process, scheduling with cron expressions, delaying messages, building FIFO queues with parallelism and flow control, configuring retries and callbacks, handling a dead letter queue (DLQ), deduplicating messages, fanning out to multiple endpoints, verifying QStash webhook signatures (Next.js App Router, Pages Router, and Edge Runtime), running a local QStash dev server, or migrating regions. Also use when the user asks for a serverless cron job, async task queue, job scheduler, delayed delivery, webhook delivery with retries, or event-driven messaging between services.

Use this Skill: https://skilld.dev/gh/upstash/skills/upstash-qstash-js

This session only. Nothing lands on disk.

fundamentalsurl-groups.md

≈763 tokens on demand. Your agent reads this file only when SKILL.md points to it.

URL Groups

URL Groups (also called Topics) let you publish a single message to multiple endpoints simultaneously.

Creating URL Groups

Add endpoints to create or update a URL group:

import { Client } from "@upstash/qstash";

const client = new Client({ token: process.env.QSTASH_TOKEN! });

await client.urlGroups().addEndpoints({
  name: "payment-webhooks",
  endpoints: [
    { url: "https://api1.example.com/webhook" },
    { url: "https://api2.example.com/webhook" },
    { url: "https://api3.example.com/webhook", name: "primary" },
  ],
});
  • name: URL group identifier (alphanumeric, hyphens, underscores, periods)
  • url: Endpoint URL (required)
  • name: Optional endpoint name for identification

Publishing to URL Groups

Publish once, deliver to all endpoints:

const result = await client.publishJSON({
  urlGroup: "payment-webhooks",
  body: { orderId: "123", amount: 99.99, status: "paid" },
});

// Returns array with result for each endpoint
result.forEach((r) => {
  console.log(`Sent to ${r.url}: ${r.messageId}`);
});

Each endpoint gets a separate message with its own retry logic and tracking.

Managing Endpoints

Remove Endpoints

Remove by URL or name:

// Remove by URL
await client.urlGroups().removeEndpoints({
  name: "payment-webhooks",
  endpoints: [{ url: "https://api2.example.com/webhook" }],
});

// Remove by endpoint name
await client.urlGroups().removeEndpoints({
  name: "payment-webhooks",
  endpoints: [{ name: "primary" }],
});

List URL Groups

const groups = await client.urlGroups().list();

groups.forEach((group) => {
  console.log(`${group.name}: ${group.endpoints.length} endpoints`);
  group.endpoints.forEach((ep) => {
    console.log(`  - ${ep.url}${ep.name ? ` (${ep.name})` : ""}`);
  });
});

Get Specific URL Group

const group = await client.urlGroups().get("payment-webhooks");

console.log(`Created: ${new Date(group.createdAt)}`);
console.log(`Updated: ${new Date(group.updatedAt)}`);
console.log(`Endpoints: ${group.endpoints.length}`);

Delete URL Group

await client.urlGroups().delete("payment-webhooks");

Deleting a URL group does not affect in-flight messages.

URL Group vs Individual Publishing

Use URL Groups when:

  • Broadcasting same message to multiple endpoints
  • Need to manage endpoint list centrally
  • Adding/removing endpoints dynamically
  • All endpoints process the same data

Use individual publishing when:

  • Each endpoint needs different message content
  • Different retry/timeout settings per endpoint
  • Endpoints have different purposes

All Message Options Work

URL Groups support all publishing options:

await client.publishJSON({
  urlGroup: "notifications",
  body: { event: "user.signup", userId: "123" },
  delay: 60,
  retries: 5,
  callback: "https://api.example.com/callback",
  deduplicationId: "signup-123",
});

See Publishing Messages for all options.

Source: SKILL.md on GitHub

No alerts17d3 checks · Risk SAFE
  • Gen Agent Trust Hub17d

    The skill provides comprehensive documentation and implementation guides for the Upstash QStash JS SDK. It includes a local development feature that automatically downloads and executes the official QStash CLI binary. While this involves remote code download and execution, it originates from the trusted vendor. The skill also processes external webhooks, creating a surface for indirect prompt injection, which is mitigated by built-in signature verification instructions.

  • Socket17d

    No alerts

  • Snyk17d

    Risk: LOW · No issues

Signed by skilld at 36daab8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 5 days ago.

Activeupdated last month
metadata
{
  "author": "Upstash",
  "homepage": "https://upstash.com"
}

README badge

README badge for upstash/skills/upstash-qstash-js