惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Jina AI
Jina AI
博客园 - 司徒正美
大猫的无限游戏
大猫的无限游戏
博客园 - 三生石上(FineUI控件)
J
Java Code Geeks
博客园 - 聂微东
酷 壳 – CoolShell
酷 壳 – CoolShell
爱范儿
爱范儿
美团技术团队
腾讯CDC
博客园 - Franky
MyScale Blog
MyScale Blog
人人都是产品经理
人人都是产品经理
罗磊的独立博客
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
aimingoo的专栏
aimingoo的专栏
博客园_首页
V
V2EX
Martin Fowler
Martin Fowler
T
The Blog of Author Tim Ferriss

Workflow SDK Documentation

Patterns for Defining Tools Human-in-the-Loop Building Durable AI Agents Queueing User Messages Resumable Streams Sleep, Suspense, and Scheduling Streaming Updates from Tools API Reference Workflow Globals Changelog Resilient run start Cookbook Building a World Deploying Astro Express Fastify Hono Getting Started NestJS Next.js Nitro Nuxt Python SvelteKit Vite corrupted-event-log fetch-in-workflow hook-conflict Errors
resumeWebhook
2026-05-31 · via Workflow SDK Documentation

Resume a paused workflow by sending an HTTP request to a webhook token.

Resumes a workflow run by sending an HTTP Request to a webhook identified by its token.

This function creates a hook_received event and re-triggers the workflow to continue execution. It's designed to be called from API routes or server actions that receive external HTTP requests.

resumeWebhook is a runtime function that must be called from outside a workflow function.

import { resumeWebhook } from "workflow/api";

export async function POST(request: Request) {
  const url = new URL(request.url);
  const token = url.searchParams.get("token");

  if (!token) {
    return new Response("Missing token", { status: 400 });
  }

  try {
    const response = await resumeWebhook(token, request); 
    return response;
  } catch (error) {
    return new Response("Webhook not found", { status: 404 });
  }
}

Parameters

NameTypeDescription
tokenstringThe unique token identifying the hook
requestRequestThe request to send to the hook

Returns

Returns a Promise<Response> that resolves to:

  • Response: The HTTP response from the workflow's respondWith() call

Throws an error if the webhook token is not found or invalid.

In most cases, you should not need to call resumeWebhook() directly. When you use createWebhook(), the framework automatically generates a random webhook token and provides a public URL at /.well-known/workflow/v1/webhook/:token. External systems can send HTTP requests directly to that URL.

For server-side hook resumption with deterministic tokens, use resumeHook() with createHook() instead.

Forward an incoming HTTP request to a webhook by token:

import { resumeWebhook } from "workflow/api";

export async function POST(request: Request) {
  const url = new URL(request.url);
  const token = url.searchParams.get("token");

  if (!token) {
    return new Response("Token required", { status: 400 });
  }

  try {
    const response = await resumeWebhook(token, request); 
    return response; // Returns the workflow's custom response
  } catch (error) {
    return new Response("Webhook not found", { status: 404 });
  }
}