cursor-webhooks
FreeRuns bundled scriptsNot checkedReceive and verify Cursor Cloud Agent webhooks. Use when setting up Cursor webhook handlers, debugging signature verification, or handling Cloud Agent status…
by hookdeck★ 104 GitHub starsAbout this skill
Cursor Webhooks
When to Use This Skill
- Setting up Cursor Cloud Agent webhook handlers
- Debugging signature verification failures
- Understanding Cursor webhook event types and payloads
- Handling Cloud Agent status change events (ERROR, FINISHED)
Essential Code (USE THIS)
Cursor Signature Verification (JavaScript)
const crypto = require('crypto');
function verifyCursorWebhook(rawBody, signatureHeader, secret) {
if (!signatureHeader || !secret) return false;
// Cursor sends: sha256=xxxx
const [algorithm, signature] = signatureHeader.split('=');
if (algorithm !== 'sha256') return false;
const expected = crypto
.createHmac('sha256', secret)
.update(rawBody)
.digest('hex');
try {
return crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected));
} catch {
return false;
}
}
Express Webhook Handler
const express = require('express');
const app = express();
// CRITICAL: Use express.raw() - Cursor requires raw body for signature verification
app.post('/webhooks/cursor',
express.raw({ type: 'application/json' }),
(req, res) => {
const signature = req.headers['x-webhook-signature'];
const webhookId = req.headers['x-webhook-id'];
const event = req.headers['x-webhook-event'];
// Verify signature
if (!verifyCursorWebhook(req.body, signature, process.env.CURSOR_WEBHOOK_SECRET)) {
console.error('Cursor signature verification failed');
return res.status(401).send('Invalid signature');
}
// Parse payload after verification
const payload = JSON.parse(req.body.toString());
console.log(`Received ${event} (id: ${webhookId})`);
// Handle status changes
if (event === 'statusChange') {
console.log(`Agent ${payload.id} status: ${payload.status}`);
if (payload.status === 'FINISHED') {
console.log(`Summary: ${payload.summary}`);
} else if (payload.status === 'ERROR') {
console.error(`Agent error for ${payload.id}`);
}
}
res.json({ received: true });
}
);
Python Signature Verification (FastAPI)
import hmac
import hashlib
from fastapi import Request, HTTPException
def verify_cursor_webhook(body: bytes, signature_header: str, secret: str) -> bool:
if not signature_header or not secret:
return False
# Cursor sends: sha256=xxxx
parts = signature_header.split('=')
if len(parts) != 2 or parts[0] != 'sha256':
return False
signature = parts[1]
expected = hmac.new(
secret.encode(),
body,
hashlib.sha256
).hexdigest()
# Timing-safe comparison
return hmac.compare_digest(signature, expected)
Common Event Types
| Event Type | Description | Common Use Cases |
|---|---|---|
statusChange |
Agent status changed | Monitor agent completion, handle errors |
Event Payload Structure
{
"event": "statusChange",
"timestamp": "2024-01-15T10:30:00Z",
"id": "bc_abc123",
"status": "FINISHED", // or "ERROR"
"source": {
"repository": "https://github.com/your-org/your-repo",
"ref": "main"
},
"target": {
"url": "https://cursor.com/agents?id=bc_abc123",
"branchName": "cursor/add-readme-1234",
"prUrl": "https://github.com/your-org/your-repo/pull/1234"
},
"summary": "Added README.md with installation instructions"
}
Some fields are optional and only included when available (a FINISHED agent with no pull request has no target.prUrl). id is the agent ID, not a delivery ID.
Environment Variables
# The webhook.secret you set when creating the agent
CURSOR_WEBHOOK_SECRET=your_webhook_secret_here
Cursor's docs describe no dashboard setting for webhooks. You choose the secret yourself and pass it, with the URL, in the webhook object of the legacy v0 Create An Agent request (POST /v0/agents); the current Cloud Agents API lists webhooks as coming soon. The secret is optional in the API but must be at least 32 characters when set, so always set one.
Local Development
# Start tunnel (no account needed)
npx hookdeck-cli listen 3000 cursor --path /webhooks/cursor
Then create a small agent with the tunnel URL as webhook.url. Cursor documents no test button.
Resources
overview.md- What Cursor webhooks are, event typessetup.md- Setwebhook.urlandwebhook.secretwhen creating an agent (v0 API)verification.md- Signature verification details and gotchasexamples/- Runnable examples per framework
Recommended: webhook-handler-patterns
For production-ready webhook handling, also use the webhook-handler-patterns skill:
Install cursor-webhooks in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
FAQ
What does the cursor-webhooks skill do?
Receive and verify Cursor Cloud Agent webhooks. Use when setting up Cursor webhook handlers, debugging signature verification, or handling Cloud Agent status change events (ERROR, FINISHED).
How do I install the cursor-webhooks skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the cursor-webhooks skill run scripts?
Yes, this skill bundles executable scripts. Review the source before installing.
Related skills
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
by Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
by Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
by Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
by Anthropic