<template><div><h1 id="webhook-触发" tabindex="-1"><a class="header-anchor" href="#webhook-触发"><span>Webhook 触发</span></a></h1>
<p>通过 HTTP 请求远程触发工作流执行。</p>
<h2 id="启用-webhook" tabindex="-1"><a class="header-anchor" href="#启用-webhook"><span>启用 Webhook</span></a></h2>
<ol>
<li>打开工作流设置</li>
<li>选择触发器为「Webhook」</li>
<li>可选配置 API Key</li>
</ol>
<h2 id="触发接口" tabindex="-1"><a class="header-anchor" href="#触发接口"><span>触发接口</span></a></h2>
<div class="language-text line-numbers-mode" data-highlighter="prismjs" data-ext="text"><pre v-pre><code class="language-text"><span class="line">POST /api/workflow/trigger/{workflow_id}</span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div></div></div><h3 id="请求头" tabindex="-1"><a class="header-anchor" href="#请求头"><span>请求头</span></a></h3>
<div class="language-text line-numbers-mode" data-highlighter="prismjs" data-ext="text"><pre v-pre><code class="language-text"><span class="line">X-API-Key: your-api-key  (如果配置了 API Key)</span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div></div></div><h3 id="请求体" tabindex="-1"><a class="header-anchor" href="#请求体"><span>请求体</span></a></h3>
<div class="language-json line-numbers-mode" data-highlighter="prismjs" data-ext="json"><pre v-pre><code class="language-json"><span class="line"><span class="token punctuation">{</span></span>
<span class="line">  <span class="token property">"params"</span><span class="token operator">:</span> <span class="token punctuation">{</span></span>
<span class="line">    <span class="token property">"key"</span><span class="token operator">:</span> <span class="token string">"value"</span></span>
<span class="line">  <span class="token punctuation">}</span></span>
<span class="line"><span class="token punctuation">}</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h3 id="响应" tabindex="-1"><a class="header-anchor" href="#响应"><span>响应</span></a></h3>
<div class="language-json line-numbers-mode" data-highlighter="prismjs" data-ext="json"><pre v-pre><code class="language-json"><span class="line"><span class="token punctuation">{</span></span>
<span class="line">  <span class="token property">"code"</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span></span>
<span class="line">  <span class="token property">"msg"</span><span class="token operator">:</span> <span class="token string">"工作流已触发"</span><span class="token punctuation">,</span></span>
<span class="line">  <span class="token property">"data"</span><span class="token operator">:</span> <span class="token punctuation">{</span></span>
<span class="line">    <span class="token property">"session_id"</span><span class="token operator">:</span> <span class="token string">"xxx"</span></span>
<span class="line">  <span class="token punctuation">}</span></span>
<span class="line"><span class="token punctuation">}</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></div></template>


