Skip to main content ホーム クリエイター jeremylongshore tons-of-skills-marketplace langfuse-webhooks-events
langfuse-webhooks-events Configure Langfuse webhooks for prompt change notifications and event-driven workflows.
Use when setting up prompt change notifications, triggering CI/CD on prompt updates,
or integrating Langfuse events with Slack and external systems.
Trigger with phrases like "langfuse webhooks", "langfuse events",
"langfuse notifications", "langfuse prompt webhook", "langfuse alerts".
インストールへ移動 Skills Marketplace コミュニティが作成したAIスキルを発見・探索
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
直接コマンドでは確認用 Prompt が省略されます。実行前にソースを確認してください。
npx skills add https://github.com/jeremylongshore/tons-of-skills-marketplace --skill langfuse-webhooks-eventsコマンドは1行のまま表示されます。コピー前に横へスクロールして全体を確認してください。
ローカルで確認しますか?SkillsMP が現在取得できるファイルをダウンロードできます。
Zipをダウンロード ダウンロード中... このリポジトリの他の Skills langchain-deploy-integration Deploy a LangChain 1.0 / LangGraph 1.0 app to Cloud Run, Vercel, or LangServe correctly — with timeouts sized for chain length, cold-start mitigation, SSE anti-buffering headers, and Secret Manager over .env. Use when prepping a first production deploy, debugging a stream that hangs behind a proxy, or diagnosing p99 latency spikes. Trigger with "langchain deploy", "langchain cloud run", "langchain vercel python", "langchain langserve", or "langchain docker".
langchain-langgraph-agents Build a correct LangGraph 1.0 ReAct agent with create_react_agent — typed tools, error propagation, recursion caps, and stop conditions that actually stop. Use when writing a first tool-calling agent, migrating from AgentExecutor or initialize_agent, or diagnosing an agent that loops on vague prompts. Trigger with "langgraph agent", "create_react_agent", "langgraph tool calling", "AgentExecutor migration", or "agent loop cost".
langchain-langgraph-human-in-loop Build LangGraph 1.0 human-in-the-loop approval flows with interrupt_before /
interrupt_after and Command(resume=...) — JSON-serializable state, clean
resume semantics, and UI wiring for approval decisions. Use when adding an
approval gate before an expensive tool call, wiring a Slack/web UI for agent
approvals, or debugging a graph that crashes on interrupt.
Trigger with "langgraph human in loop", "langgraph interrupt_before",
"langgraph approval flow", "Command resume", "langgraph HITL".
name langfuse-webhooks-events description Configure Langfuse webhooks for prompt change notifications and event-driven workflows.
Use when setting up prompt change notifications, triggering CI/CD on prompt updates,
or integrating Langfuse events with Slack and external systems.
Trigger with phrases like "langfuse webhooks", "langfuse events",
"langfuse notifications", "langfuse prompt webhook", "langfuse alerts".
allowed-tools Read, Write, Edit version 1.12.0 license MIT author Jeremy Longshore <jeremy@intentsolutions.io> tags ["saas","langfuse","webhooks"] compatibility Designed for Claude Code
Langfuse Webhooks & Events
Overview
Configure Langfuse webhooks to receive notifications on prompt version changes. Langfuse supports webhook events for prompt lifecycle: Created , Updated (labels/tags changed), and Deleted . Use webhooks to trigger CI/CD pipelines, sync prompts to external systems, or notify teams via Slack.
Prerequisites
Langfuse Cloud or self-hosted instance
HTTPS endpoint to receive webhook POST requests
Webhook secret for HMAC signature verification
Instructions
Step 1: Create Webhook Endpoint
import { NextRequest , NextResponse } from "next/server" ;
import crypto from "crypto" ;
const WEBHOOK_SECRET = process.env .LANGFUSE_WEBHOOK_SECRET !;
interface LangfuseWebhookEvent {
event : "prompt.created" | "prompt.updated" | "prompt.deleted" ;
timestamp : string ;
data : {
promptName : string ;
promptVersion : number ;
labels ?: string [];
projectId : string ;
[key : string ]: any ;
};
}
function verifySignature (payload : , : ): {
expected = crypto
. ( , )
. (payload)
. ( );
crypto. (
. (signature),
. (expected)
);
}
( ) {
payload = request. ();
signature = request. . ( );
(!signature || ! (payload, signature)) {
. ({ : }, { : });
}
: = . (payload);
. ( );
(event. ) {
:
(event. );
;
:
(event. );
;
:
(event. );
;
}
. ({ : });
}
( ) {
(data. ?. ( )) {
(data. , data. );
}
({
: ,
: data. ,
});
}
( ) {
(data. ?. ( )) {
({
: ,
});
}
}
( ) {
({
: ,
: ,
});
}
string
signature
string
boolean
const
createHmac
"sha256"
WEBHOOK_SECRET
update
digest
"hex"
return
timingSafeEqual
Buffer
from
Buffer
from
export
async
function
POST
request : NextRequest
const
await
text
const
headers
get
"x-langfuse-signature"
if
verifySignature
return
NextResponse
json
error
"Invalid signature"
status
401
const
event
LangfuseWebhookEvent
JSON
parse
console
log
`Langfuse webhook: ${event.event} - ${event.data.promptName} `
switch
event
case
"prompt.created"
await
handlePromptCreated
data
break
case
"prompt.updated"
await
handlePromptUpdated
data
break
case
"prompt.deleted"
await
handlePromptDeleted
data
break
return
NextResponse
json
received
true
async
function
handlePromptCreated
data : LangfuseWebhookEvent ["data" ]
if
labels
includes
"production"
await
triggerPromptDeployPipeline
promptName
promptVersion
await
notifySlack
text
`New prompt version: *${data.promptName} * v${data.promptVersion} `
labels
labels
async
function
handlePromptUpdated
data : LangfuseWebhookEvent ["data" ]
if
labels
includes
"production"
await
notifySlack
text
`Prompt *${data.promptName} * v${data.promptVersion} promoted to production`
async
function
handlePromptDeleted
data : LangfuseWebhookEvent ["data" ]
await
notifySlack
text
`Prompt *${data.promptName} * v${data.promptVersion} deleted`
level
"warning"
Step 2: Configure Webhook in Langfuse
Navigate to Prompts > Create Automation > Webhook
Enter your endpoint URL: https://your-domain.com/api/webhooks/langfuse
Select events to watch: Created, Updated, Deleted
Optionally filter to specific prompts
Generate and save the webhook secret
Click Test to verify connectivity
Step 3: Slack Integration
async function notifySlack (params : {
text: string ;
labels?: string [];
level?: "info" | "warning" ;
} ) {
const color = params.level === "warning" ? "#ff9800" : "#36a64f" ;
await fetch (process.env .SLACK_WEBHOOK_URL !, {
method : "POST" ,
headers : { "Content-Type" : "application/json" },
body : JSON .stringify ({
attachments : [
{
color,
blocks : [
{
type : "section" ,
text : { type : "mrkdwn" , text : params.text },
},
...(params.labels
? [
{
type : "context" ,
elements : [
{
type : "mrkdwn" ,
text : `Labels: ${params.labels.join(", " )} ` ,
},
],
},
]
: []),
],
},
],
}),
});
}
Step 4: Trigger CI/CD Pipeline on Prompt Changes
async function triggerPromptDeployPipeline (promptName : string , version : number ) {
await fetch (
`https://api.github.com/repos/${process.env.GITHUB_REPO} /dispatches` ,
{
method : "POST" ,
headers : {
Authorization : `Bearer ${process.env.GITHUB_TOKEN} ` ,
"Content-Type" : "application/json" ,
},
body : JSON .stringify ({
event_type : "prompt-updated" ,
client_payload : { promptName, version },
}),
}
);
}
name: Deploy Updated Prompt
on:
repository_dispatch:
types: [prompt-updated ]
jobs:
test-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: "20" , cache: "npm" }
- run: npm ci
- name: Test updated prompt
env:
LANGFUSE_PUBLIC_KEY: ${{ secrets.LANGFUSE_PUBLIC_KEY }}
LANGFUSE_SECRET_KEY: ${{ secrets.LANGFUSE_SECRET_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
echo "Testing prompt: ${{ github.event.client_payload.promptName }}"
npx vitest run tests/ai/prompt-quality.test.ts
Step 5: Webhook Reliability with Retry Queue
import { Queue , Worker } from "bullmq" ;
const webhookQueue = new Queue ("langfuse-webhooks" , {
connection : { host : process.env .REDIS_HOST },
});
export async function POST (request : NextRequest ) {
const payload = await request.text ();
await webhookQueue.add ("process" , JSON .parse (payload), {
attempts : 3 ,
backoff : { type : "exponential" , delay : 1000 },
});
return NextResponse .json ({ received : true });
}
const worker = new Worker (
"langfuse-webhooks" ,
async (job) => {
const event = job.data as LangfuseWebhookEvent ;
},
{ connection : { host : process.env .REDIS_HOST } }
);
Webhook Event Reference Event Trigger Use Case prompt.createdNew prompt version added Run regression tests, notify team prompt.updatedLabels or tags changed Detect production promotions prompt.deletedPrompt version removed Alert on accidental deletion
Error Handling Issue Cause Solution Invalid signature (401) Wrong webhook secret Re-copy secret from Langfuse settings Missed events Handler threw error Queue events, return 200 immediately Duplicate processing Retry without idempotency Dedupe by event + timestamp + promptName Webhook timeout Slow handler Enqueue and process async
Resources