[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6F9GYM8Z78JEB20DK0QKQ5M":3,"skill-same:01M6F9GYM8Z78JEB20DK0QKQ5M":75},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":43,"linkOnly":44,"markdownContent":45,"markdownBody":46,"frontMatter":47,"refName":52,"commitSha":53,"skillDirectory":54,"forksCount":55,"repositoryHtmlUrl":56,"repositoryHomepageUrl":6,"ownerHtmlUrl":57,"ownerBlogUrl":58,"ownerDescription":59,"updatedAt":60,"install":61,"resources":74},"01M6F9GYM8Z78JEB20DK0QKQ5M","twinmind-webhooks-events",null,"Handle TwinMind webhooks and events for real-time meeting notifications.\nUse when implementing webhook handlers, processing meeting events,\nor building real-time integrations.\nTrigger with phrases like \"twinmind webhooks\", \"twinmind events\",\n\"twinmind notifications\", \"meeting webhook handler\".","Dicklesworthstone\u002Fpi_agent_rust","Dicklesworthstone","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F35050222?v=4","01M6CG26AR942CSVMN1M5E3DSE","Jeff Emanuel","01M6CG26EPP71PSHW1VDS71121",1992,"MIT","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Fplugins-community\u002Fplugins\u002Fsaas-packs\u002Ftwinmind-pack\u002Fskills\u002Ftwinmind-webhooks-events\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42],"twinmind webhooks events","webhooks","events","io","when","handler","for","implementing","meeting","with","webhook handler","processing","trigger","notifications","webhook","time","use","edit","write","read","grep","integrations","Bash","real-time","2026-11-10 10:12:30",false,"---\nname: twinmind-webhooks-events\ndescription: |\n  Handle TwinMind webhooks and events for real-time meeting notifications.\n  Use when implementing webhook handlers, processing meeting events,\n  or building real-time integrations.\n  Trigger with phrases like \"twinmind webhooks\", \"twinmind events\",\n  \"twinmind notifications\", \"meeting webhook handler\".\nallowed-tools: Read, Write, Edit, Bash(npm:*), Grep\nversion: 1.0.0\nlicense: MIT\nauthor: Jeremy Longshore \u003Cjeremy@intentsolutions.io>\n---\n\n# TwinMind Webhooks & Events\n\n## Overview\nImplement webhook handlers for real-time TwinMind meeting events and notifications.\n\n## Prerequisites\n- TwinMind Pro\u002FEnterprise account\n- Public HTTPS endpoint for webhooks\n- Webhook secret configured\n- Understanding of event-driven architecture\n\n## Instructions\n\n### Step 1: Define Event Types\n\n```typescript\n\u002F\u002F src\u002Ftwinmind\u002Fevents\u002Ftypes.ts\nexport enum TwinMindEventType {\n  \u002F\u002F Transcription events\n  TRANSCRIPTION_STARTED = 'transcription.started',\n  TRANSCRIPTION_COMPLETED = 'transcription.completed',\n  TRANSCRIPTION_FAILED = 'transcription.failed',\n\n  \u002F\u002F Meeting events\n  MEETING_STARTED = 'meeting.started',\n  MEETING_ENDED = 'meeting.ended',\n  MEETING_PARTICIPANT_JOINED = 'meeting.participant.joined',\n  MEETING_PARTICIPANT_LEFT = 'meeting.participant.left',\n\n  \u002F\u002F Summary events\n  SUMMARY_GENERATED = 'summary.generated',\n  ACTION_ITEMS_EXTRACTED = 'action_items.extracted',\n\n  \u002F\u002F Calendar events\n  CALENDAR_SYNCED = 'calendar.synced',\n  CALENDAR_EVENT_REMINDER = 'calendar.event.reminder',\n\n  \u002F\u002F Account events\n  USAGE_LIMIT_WARNING = 'usage.limit.warning',\n  USAGE_LIMIT_EXCEEDED = 'usage.limit.exceeded',\n}\n\nexport interface TwinMindEvent\u003CT = any> {\n  id: string;\n  type: TwinMindEventType;\n  created_at: string;\n  data: T;\n}\n\nexport interface TranscriptionCompletedData {\n  transcript_id: string;\n  duration_seconds: number;\n  language: string;\n  word_count: number;\n  speaker_count: number;\n  model: string;\n}\n\nexport interface MeetingEndedData {\n  meeting_id: string;\n  transcript_id: string;\n  title: string;\n  duration_seconds: number;\n  participants: string[];\n  summary_available: boolean;\n}\n\nexport interface SummaryGeneratedData {\n  summary_id: string;\n  transcript_id: string;\n  action_item_count: number;\n  key_point_count: number;\n}\n\nexport interface ActionItemsExtractedData {\n  transcript_id: string;\n  action_items: Array\u003C{\n    text: string;\n    assignee?: string;\n    due_date?: string;\n  }>;\n}\n```\n\n### Step 2: Implement Webhook Handler\n\n```typescript\n\u002F\u002F src\u002Ftwinmind\u002Fwebhooks\u002Fhandler.ts\nimport crypto from 'crypto';\nimport express, { Request, Response, NextFunction } from 'express';\nimport { TwinMindEvent, TwinMindEventType } from '..\u002Fevents\u002Ftypes';\n\n\u002F\u002F Signature verification middleware\nexport function verifySignature(\n  req: Request,\n  res: Response,\n  next: NextFunction\n): void {\n  const signature = req.headers['x-twinmind-signature'] as string;\n  const timestamp = req.headers['x-twinmind-timestamp'] as string;\n  const secret = process.env.TWINMIND_WEBHOOK_SECRET!;\n\n  if (!signature || !timestamp) {\n    res.status(401).json({ error: 'Missing signature or timestamp' });\n    return;\n  }\n\n  \u002F\u002F Check timestamp to prevent replay attacks (5 minute window)\n  const timestampMs = parseInt(timestamp) * 1000;\n  const now = Date.now();\n  if (Math.abs(now - timestampMs) > 5 * 60 * 1000) {\n    res.status(401).json({ error: 'Request too old' });\n    return;\n  }\n\n  \u002F\u002F Verify signature\n  const payload = `${timestamp}.${JSON.stringify(req.body)}`;\n  const expectedSignature = crypto\n    .createHmac('sha256', secret)\n    .update(payload)\n    .digest('hex');\n\n  if (!crypto.timingSafeEqual(\n    Buffer.from(signature),\n    Buffer.from(`sha256=${expectedSignature}`)\n  )) {\n    res.status(401).json({ error: 'Invalid signature' });\n    return;\n  }\n\n  next();\n}\n\n\u002F\u002F Event handlers registry\ntype EventHandler\u003CT = any> = (event: TwinMindEvent\u003CT>) => Promise\u003Cvoid>;\n\nconst handlers = new Map\u003CTwinMindEventType, EventHandler[]>();\n\nexport function registerHandler\u003CT>(\n  eventType: TwinMindEventType,\n  handler: EventHandler\u003CT>\n): void {\n  const existing = handlers.get(eventType) || [];\n  existing.push(handler);\n  handlers.set(eventType, existing);\n}\n\n\u002F\u002F Main webhook route handler\nexport async function handleWebhook(\n  req: Request,\n  res: Response\n): Promise\u003Cvoid> {\n  const event = req.body as TwinMindEvent;\n\n  console.log(`Received event: ${event.type} (${event.id})`);\n\n  \u002F\u002F Acknowledge receipt immediately\n  res.status(200).json({ received: true, event_id: event.id });\n\n  \u002F\u002F Process event asynchronously\n  try {\n    const eventHandlers = handlers.get(event.type as TwinMindEventType);\n\n    if (eventHandlers && eventHandlers.length > 0) {\n      await Promise.all(\n        eventHandlers.map(handler => handler(event))\n      );\n    } else {\n      console.log(`No handlers registered for event type: ${event.type}`);\n    }\n  } catch (error) {\n    console.error(`Error processing event ${event.id}:`, error);\n    \u002F\u002F Don't throw - we already acknowledged receipt\n  }\n}\n```\n\n### Step 3: Implement Event Handlers\n\n```typescript\n\u002F\u002F src\u002Ftwinmind\u002Fwebhooks\u002Fevent-handlers.ts\nimport {\n  TwinMindEvent,\n  TwinMindEventType,\n  TranscriptionCompletedData,\n  MeetingEndedData,\n  SummaryGeneratedData,\n  ActionItemsExtractedData,\n} from '..\u002Fevents\u002Ftypes';\nimport { registerHandler } from '.\u002Fhandler';\nimport { notifySlack, sendEmail } from '..\u002Fnotifications';\nimport { createTasksInLinear } from '..\u002Fintegrations\u002Flinear';\n\n\u002F\u002F Handle transcription completed\nregisterHandler\u003CTranscriptionCompletedData>(\n  TwinMindEventType.TRANSCRIPTION_COMPLETED,\n  async (event) => {\n    const { transcript_id, duration_seconds, word_count, speaker_count } = event.data;\n\n    console.log(`Transcription completed: ${transcript_id}`);\n    console.log(`  Duration: ${duration_seconds}s`);\n    console.log(`  Words: ${word_count}`);\n    console.log(`  Speakers: ${speaker_count}`);\n\n    \u002F\u002F Trigger summary generation\n    const client = getTwinMindClient();\n    await client.post('\u002Fsummarize', { transcript_id });\n  }\n);\n\n\u002F\u002F Handle meeting ended\nregisterHandler\u003CMeetingEndedData>(\n  TwinMindEventType.MEETING_ENDED,\n  async (event) => {\n    const { meeting_id, title, duration_seconds, participants, summary_available } = event.data;\n\n    console.log(`Meeting ended: ${title} (${meeting_id})`);\n\n    \u002F\u002F Notify participants\n    await notifySlack({\n      channel: '#meetings',\n      message: `Meeting \"${title}\" has ended (${Math.round(duration_seconds \u002F 60)} minutes)`,\n      participants,\n    });\n\n    \u002F\u002F If summary is ready, send it\n    if (summary_available) {\n      const client = getTwinMindClient();\n      const summary = await client.get(`\u002Fsummaries\u002F${event.data.transcript_id}`);\n\n      await sendEmail({\n        to: participants,\n        subject: `Meeting Summary: ${title}`,\n        body: summary.data.summary,\n      });\n    }\n  }\n);\n\n\u002F\u002F Handle summary generated\nregisterHandler\u003CSummaryGeneratedData>(\n  TwinMindEventType.SUMMARY_GENERATED,\n  async (event) => {\n    const { summary_id, transcript_id, action_item_count } = event.data;\n\n    console.log(`Summary generated: ${summary_id}`);\n    console.log(`  Action items: ${action_item_count}`);\n\n    \u002F\u002F Store summary in database\n    await db.summaries.create({\n      id: summary_id,\n      transcript_id,\n      created_at: new Date(event.created_at),\n    });\n  }\n);\n\n\u002F\u002F Handle action items extracted\nregisterHandler\u003CActionItemsExtractedData>(\n  TwinMindEventType.ACTION_ITEMS_EXTRACTED,\n  async (event) => {\n    const { transcript_id, action_items } = event.data;\n\n    console.log(`Action items extracted: ${action_items.length}`);\n\n    \u002F\u002F Create tasks in project management tool\n    if (action_items.length > 0) {\n      await createTasksInLinear(action_items);\n    }\n  }\n);\n\n\u002F\u002F Handle usage warning\nregisterHandler(\n  TwinMindEventType.USAGE_LIMIT_WARNING,\n  async (event) => {\n    console.warn('Usage limit warning:', event.data);\n\n    await notifySlack({\n      channel: '#alerts',\n      message: `:warning: TwinMind usage at ${event.data.percent_used}% of limit`,\n    });\n  }\n);\n```\n\n### Step 4: Set Up Webhook Endpoint\n\n```typescript\n\u002F\u002F src\u002Fapi\u002Fwebhooks\u002Ftwinmind.ts\nimport express from 'express';\nimport { verifySignature, handleWebhook } from '..\u002F..\u002Ftwinmind\u002Fwebhooks\u002Fhandler';\n\nconst router = express.Router();\n\n\u002F\u002F Raw body parser for signature verification\nrouter.use(express.json({\n  verify: (req: any, res, buf) => {\n    req.rawBody = buf;\n  }\n}));\n\n\u002F\u002F Webhook endpoint\nrouter.post(\n  '\u002Ftwinmind',\n  verifySignature,\n  handleWebhook\n);\n\nexport default router;\n```\n\n### Step 5: Register Webhooks\n\n```typescript\n\u002F\u002F scripts\u002Fregister-webhooks.ts\nimport { getTwinMindClient } from '..\u002Fsrc\u002Ftwinmind\u002Fclient';\nimport { TwinMindEventType } from '..\u002Fsrc\u002Ftwinmind\u002Fevents\u002Ftypes';\n\nasync function registerWebhooks() {\n  const client = getTwinMindClient();\n\n  const webhookUrl = process.env.WEBHOOK_BASE_URL + '\u002Fwebhooks\u002Ftwinmind';\n\n  \u002F\u002F Register webhook\n  const response = await client.post('\u002Fwebhooks', {\n    url: webhookUrl,\n    events: [\n      TwinMindEventType.TRANSCRIPTION_COMPLETED,\n      TwinMindEventType.MEETING_ENDED,\n      TwinMindEventType.SUMMARY_GENERATED,\n      TwinMindEventType.ACTION_ITEMS_EXTRACTED,\n      TwinMindEventType.USAGE_LIMIT_WARNING,\n    ],\n    enabled: true,\n  });\n\n  console.log('Webhook registered:', response.data);\n\n  \u002F\u002F Generate and store webhook secret\n  console.log('Webhook Secret:', response.data.secret);\n  console.log('Add to .env: TWINMIND_WEBHOOK_SECRET=' + response.data.secret);\n}\n\nregisterWebhooks();\n```\n\n### Step 6: Implement Retry Logic for Failed Events\n\n```typescript\n\u002F\u002F src\u002Ftwinmind\u002Fwebhooks\u002Fretry.ts\nimport { TwinMindEvent } from '..\u002Fevents\u002Ftypes';\n\ninterface FailedEvent {\n  event: TwinMindEvent;\n  attempts: number;\n  lastError: string;\n  nextRetry: Date;\n}\n\nclass WebhookRetryQueue {\n  private queue: FailedEvent[] = [];\n  private maxRetries = 5;\n  private baseDelayMs = 60000; \u002F\u002F 1 minute\n\n  async add(event: TwinMindEvent, error: Error): Promise\u003Cvoid> {\n    const existing = this.queue.find(f => f.event.id === event.id);\n\n    if (existing) {\n      existing.attempts += 1;\n      existing.lastError = error.message;\n      existing.nextRetry = new Date(\n        Date.now() + this.baseDelayMs * Math.pow(2, existing.attempts)\n      );\n\n      if (existing.attempts >= this.maxRetries) {\n        \u002F\u002F Move to dead letter queue\n        await this.moveToDeadLetter(existing);\n        this.queue = this.queue.filter(f => f.event.id !== event.id);\n      }\n    } else {\n      this.queue.push({\n        event,\n        attempts: 1,\n        lastError: error.message,\n        nextRetry: new Date(Date.now() + this.baseDelayMs),\n      });\n    }\n  }\n\n  async processRetries(): Promise\u003Cvoid> {\n    const now = new Date();\n    const readyEvents = this.queue.filter(f => f.nextRetry \u003C= now);\n\n    for (const failedEvent of readyEvents) {\n      try {\n        await this.reprocessEvent(failedEvent.event);\n        this.queue = this.queue.filter(f => f.event.id !== failedEvent.event.id);\n        console.log(`Successfully reprocessed event: ${failedEvent.event.id}`);\n      } catch (error: any) {\n        await this.add(failedEvent.event, error);\n      }\n    }\n  }\n\n  private async reprocessEvent(event: TwinMindEvent): Promise\u003Cvoid> {\n    \u002F\u002F Re-dispatch to handlers\n    const handlers = getHandlersForEvent(event.type);\n    await Promise.all(handlers.map(h => h(event)));\n  }\n\n  private async moveToDeadLetter(failedEvent: FailedEvent): Promise\u003Cvoid> {\n    console.error(`Event ${failedEvent.event.id} moved to dead letter queue after ${failedEvent.attempts} attempts`);\n\n    \u002F\u002F Store in database for manual review\n    await db.deadLetterQueue.create({\n      event_id: failedEvent.event.id,\n      event_type: failedEvent.event.type,\n      payload: failedEvent.event,\n      attempts: failedEvent.attempts,\n      last_error: failedEvent.lastError,\n    });\n\n    \u002F\u002F Alert ops team\n    await notifySlack({\n      channel: '#alerts',\n      message: `:x: Webhook event failed after ${failedEvent.attempts} attempts: ${failedEvent.event.id}`,\n    });\n  }\n}\n\nexport const retryQueue = new WebhookRetryQueue();\n\n\u002F\u002F Start retry processor\nsetInterval(() => retryQueue.processRetries(), 60000);\n```\n\n## Output\n- Event type definitions\n- Webhook handler with signature verification\n- Event processing logic\n- Webhook registration script\n- Retry queue for failed events\n\n## Webhook Events Reference\n\n| Event | Description | Data |\n|-------|-------------|------|\n| `transcription.started` | Transcription job started | `transcript_id`, `audio_url` |\n| `transcription.completed` | Transcription finished | `transcript_id`, `duration`, `word_count` |\n| `transcription.failed` | Transcription failed | `transcript_id`, `error` |\n| `meeting.started` | Live meeting capture started | `meeting_id`, `title` |\n| `meeting.ended` | Meeting finished | `meeting_id`, `transcript_id`, `participants` |\n| `summary.generated` | AI summary ready | `summary_id`, `action_item_count` |\n| `action_items.extracted` | Action items available | `transcript_id`, `action_items[]` |\n| `usage.limit.warning` | Usage approaching limit | `percent_used`, `limit` |\n\n## Error Handling\n\n| Issue | Cause | Solution |\n|-------|-------|----------|\n| Invalid signature | Wrong secret | Verify webhook secret |\n| Event missed | Endpoint down | Implement retry queue |\n| Processing slow | Heavy handler | Use async queue |\n| Duplicate events | Retries | Implement idempotency |\n\n## Resources\n- [TwinMind Webhooks API](https:\u002F\u002Ftwinmind.com\u002Fdocs\u002Fwebhooks)\n- [Webhook Best Practices](https:\u002F\u002Ftwinmind.com\u002Fdocs\u002Fwebhook-best-practices)\n- [Event Reference](https:\u002F\u002Ftwinmind.com\u002Fdocs\u002Fevents)\n\n## Next Steps\nFor performance optimization, see `twinmind-performance-tuning`.\n","# TwinMind Webhooks & Events\n\n## Overview\nImplement webhook handlers for real-time TwinMind meeting events and notifications.\n\n## Prerequisites\n- TwinMind Pro\u002FEnterprise account\n- Public HTTPS endpoint for webhooks\n- Webhook secret configured\n- Understanding of event-driven architecture\n\n## Instructions\n\n### Step 1: Define Event Types\n\n```typescript\n\u002F\u002F src\u002Ftwinmind\u002Fevents\u002Ftypes.ts\nexport enum TwinMindEventType {\n  \u002F\u002F Transcription events\n  TRANSCRIPTION_STARTED = 'transcription.started',\n  TRANSCRIPTION_COMPLETED = 'transcription.completed',\n  TRANSCRIPTION_FAILED = 'transcription.failed',\n\n  \u002F\u002F Meeting events\n  MEETING_STARTED = 'meeting.started',\n  MEETING_ENDED = 'meeting.ended',\n  MEETING_PARTICIPANT_JOINED = 'meeting.participant.joined',\n  MEETING_PARTICIPANT_LEFT = 'meeting.participant.left',\n\n  \u002F\u002F Summary events\n  SUMMARY_GENERATED = 'summary.generated',\n  ACTION_ITEMS_EXTRACTED = 'action_items.extracted',\n\n  \u002F\u002F Calendar events\n  CALENDAR_SYNCED = 'calendar.synced',\n  CALENDAR_EVENT_REMINDER = 'calendar.event.reminder',\n\n  \u002F\u002F Account events\n  USAGE_LIMIT_WARNING = 'usage.limit.warning',\n  USAGE_LIMIT_EXCEEDED = 'usage.limit.exceeded',\n}\n\nexport interface TwinMindEvent\u003CT = any> {\n  id: string;\n  type: TwinMindEventType;\n  created_at: string;\n  data: T;\n}\n\nexport interface TranscriptionCompletedData {\n  transcript_id: string;\n  duration_seconds: number;\n  language: string;\n  word_count: number;\n  speaker_count: number;\n  model: string;\n}\n\nexport interface MeetingEndedData {\n  meeting_id: string;\n  transcript_id: string;\n  title: string;\n  duration_seconds: number;\n  participants: string[];\n  summary_available: boolean;\n}\n\nexport interface SummaryGeneratedData {\n  summary_id: string;\n  transcript_id: string;\n  action_item_count: number;\n  key_point_count: number;\n}\n\nexport interface ActionItemsExtractedData {\n  transcript_id: string;\n  action_items: Array\u003C{\n    text: string;\n    assignee?: string;\n    due_date?: string;\n  }>;\n}\n```\n\n### Step 2: Implement Webhook Handler\n\n```typescript\n\u002F\u002F src\u002Ftwinmind\u002Fwebhooks\u002Fhandler.ts\nimport crypto from 'crypto';\nimport express, { Request, Response, NextFunction } from 'express';\nimport { TwinMindEvent, TwinMindEventType } from '..\u002Fevents\u002Ftypes';\n\n\u002F\u002F Signature verification middleware\nexport function verifySignature(\n  req: Request,\n  res: Response,\n  next: NextFunction\n): void {\n  const signature = req.headers['x-twinmind-signature'] as string;\n  const timestamp = req.headers['x-twinmind-timestamp'] as string;\n  const secret = process.env.TWINMIND_WEBHOOK_SECRET!;\n\n  if (!signature || !timestamp) {\n    res.status(401).json({ error: 'Missing signature or timestamp' });\n    return;\n  }\n\n  \u002F\u002F Check timestamp to prevent replay attacks (5 minute window)\n  const timestampMs = parseInt(timestamp) * 1000;\n  const now = Date.now();\n  if (Math.abs(now - timestampMs) > 5 * 60 * 1000) {\n    res.status(401).json({ error: 'Request too old' });\n    return;\n  }\n\n  \u002F\u002F Verify signature\n  const payload = `${timestamp}.${JSON.stringify(req.body)}`;\n  const expectedSignature = crypto\n    .createHmac('sha256', secret)\n    .update(payload)\n    .digest('hex');\n\n  if (!crypto.timingSafeEqual(\n    Buffer.from(signature),\n    Buffer.from(`sha256=${expectedSignature}`)\n  )) {\n    res.status(401).json({ error: 'Invalid signature' });\n    return;\n  }\n\n  next();\n}\n\n\u002F\u002F Event handlers registry\ntype EventHandler\u003CT = any> = (event: TwinMindEvent\u003CT>) => Promise\u003Cvoid>;\n\nconst handlers = new Map\u003CTwinMindEventType, EventHandler[]>();\n\nexport function registerHandler\u003CT>(\n  eventType: TwinMindEventType,\n  handler: EventHandler\u003CT>\n): void {\n  const existing = handlers.get(eventType) || [];\n  existing.push(handler);\n  handlers.set(eventType, existing);\n}\n\n\u002F\u002F Main webhook route handler\nexport async function handleWebhook(\n  req: Request,\n  res: Response\n): Promise\u003Cvoid> {\n  const event = req.body as TwinMindEvent;\n\n  console.log(`Received event: ${event.type} (${event.id})`);\n\n  \u002F\u002F Acknowledge receipt immediately\n  res.status(200).json({ received: true, event_id: event.id });\n\n  \u002F\u002F Process event asynchronously\n  try {\n    const eventHandlers = handlers.get(event.type as TwinMindEventType);\n\n    if (eventHandlers && eventHandlers.length > 0) {\n      await Promise.all(\n        eventHandlers.map(handler => handler(event))\n      );\n    } else {\n      console.log(`No handlers registered for event type: ${event.type}`);\n    }\n  } catch (error) {\n    console.error(`Error processing event ${event.id}:`, error);\n    \u002F\u002F Don't throw - we already acknowledged receipt\n  }\n}\n```\n\n### Step 3: Implement Event Handlers\n\n```typescript\n\u002F\u002F src\u002Ftwinmind\u002Fwebhooks\u002Fevent-handlers.ts\nimport {\n  TwinMindEvent,\n  TwinMindEventType,\n  TranscriptionCompletedData,\n  MeetingEndedData,\n  SummaryGeneratedData,\n  ActionItemsExtractedData,\n} from '..\u002Fevents\u002Ftypes';\nimport { registerHandler } from '.\u002Fhandler';\nimport { notifySlack, sendEmail } from '..\u002Fnotifications';\nimport { createTasksInLinear } from '..\u002Fintegrations\u002Flinear';\n\n\u002F\u002F Handle transcription completed\nregisterHandler\u003CTranscriptionCompletedData>(\n  TwinMindEventType.TRANSCRIPTION_COMPLETED,\n  async (event) => {\n    const { transcript_id, duration_seconds, word_count, speaker_count } = event.data;\n\n    console.log(`Transcription completed: ${transcript_id}`);\n    console.log(`  Duration: ${duration_seconds}s`);\n    console.log(`  Words: ${word_count}`);\n    console.log(`  Speakers: ${speaker_count}`);\n\n    \u002F\u002F Trigger summary generation\n    const client = getTwinMindClient();\n    await client.post('\u002Fsummarize', { transcript_id });\n  }\n);\n\n\u002F\u002F Handle meeting ended\nregisterHandler\u003CMeetingEndedData>(\n  TwinMindEventType.MEETING_ENDED,\n  async (event) => {\n    const { meeting_id, title, duration_seconds, participants, summary_available } = event.data;\n\n    console.log(`Meeting ended: ${title} (${meeting_id})`);\n\n    \u002F\u002F Notify participants\n    await notifySlack({\n      channel: '#meetings',\n      message: `Meeting \"${title}\" has ended (${Math.round(duration_seconds \u002F 60)} minutes)`,\n      participants,\n    });\n\n    \u002F\u002F If summary is ready, send it\n    if (summary_available) {\n      const client = getTwinMindClient();\n      const summary = await client.get(`\u002Fsummaries\u002F${event.data.transcript_id}`);\n\n      await sendEmail({\n        to: participants,\n        subject: `Meeting Summary: ${title}`,\n        body: summary.data.summary,\n      });\n    }\n  }\n);\n\n\u002F\u002F Handle summary generated\nregisterHandler\u003CSummaryGeneratedData>(\n  TwinMindEventType.SUMMARY_GENERATED,\n  async (event) => {\n    const { summary_id, transcript_id, action_item_count } = event.data;\n\n    console.log(`Summary generated: ${summary_id}`);\n    console.log(`  Action items: ${action_item_count}`);\n\n    \u002F\u002F Store summary in database\n    await db.summaries.create({\n      id: summary_id,\n      transcript_id,\n      created_at: new Date(event.created_at),\n    });\n  }\n);\n\n\u002F\u002F Handle action items extracted\nregisterHandler\u003CActionItemsExtractedData>(\n  TwinMindEventType.ACTION_ITEMS_EXTRACTED,\n  async (event) => {\n    const { transcript_id, action_items } = event.data;\n\n    console.log(`Action items extracted: ${action_items.length}`);\n\n    \u002F\u002F Create tasks in project management tool\n    if (action_items.length > 0) {\n      await createTasksInLinear(action_items);\n    }\n  }\n);\n\n\u002F\u002F Handle usage warning\nregisterHandler(\n  TwinMindEventType.USAGE_LIMIT_WARNING,\n  async (event) => {\n    console.warn('Usage limit warning:', event.data);\n\n    await notifySlack({\n      channel: '#alerts',\n      message: `:warning: TwinMind usage at ${event.data.percent_used}% of limit`,\n    });\n  }\n);\n```\n\n### Step 4: Set Up Webhook Endpoint\n\n```typescript\n\u002F\u002F src\u002Fapi\u002Fwebhooks\u002Ftwinmind.ts\nimport express from 'express';\nimport { verifySignature, handleWebhook } from '..\u002F..\u002Ftwinmind\u002Fwebhooks\u002Fhandler';\n\nconst router = express.Router();\n\n\u002F\u002F Raw body parser for signature verification\nrouter.use(express.json({\n  verify: (req: any, res, buf) => {\n    req.rawBody = buf;\n  }\n}));\n\n\u002F\u002F Webhook endpoint\nrouter.post(\n  '\u002Ftwinmind',\n  verifySignature,\n  handleWebhook\n);\n\nexport default router;\n```\n\n### Step 5: Register Webhooks\n\n```typescript\n\u002F\u002F scripts\u002Fregister-webhooks.ts\nimport { getTwinMindClient } from '..\u002Fsrc\u002Ftwinmind\u002Fclient';\nimport { TwinMindEventType } from '..\u002Fsrc\u002Ftwinmind\u002Fevents\u002Ftypes';\n\nasync function registerWebhooks() {\n  const client = getTwinMindClient();\n\n  const webhookUrl = process.env.WEBHOOK_BASE_URL + '\u002Fwebhooks\u002Ftwinmind';\n\n  \u002F\u002F Register webhook\n  const response = await client.post('\u002Fwebhooks', {\n    url: webhookUrl,\n    events: [\n      TwinMindEventType.TRANSCRIPTION_COMPLETED,\n      TwinMindEventType.MEETING_ENDED,\n      TwinMindEventType.SUMMARY_GENERATED,\n      TwinMindEventType.ACTION_ITEMS_EXTRACTED,\n      TwinMindEventType.USAGE_LIMIT_WARNING,\n    ],\n    enabled: true,\n  });\n\n  console.log('Webhook registered:', response.data);\n\n  \u002F\u002F Generate and store webhook secret\n  console.log('Webhook Secret:', response.data.secret);\n  console.log('Add to .env: TWINMIND_WEBHOOK_SECRET=' + response.data.secret);\n}\n\nregisterWebhooks();\n```\n\n### Step 6: Implement Retry Logic for Failed Events\n\n```typescript\n\u002F\u002F src\u002Ftwinmind\u002Fwebhooks\u002Fretry.ts\nimport { TwinMindEvent } from '..\u002Fevents\u002Ftypes';\n\ninterface FailedEvent {\n  event: TwinMindEvent;\n  attempts: number;\n  lastError: string;\n  nextRetry: Date;\n}\n\nclass WebhookRetryQueue {\n  private queue: FailedEvent[] = [];\n  private maxRetries = 5;\n  private baseDelayMs = 60000; \u002F\u002F 1 minute\n\n  async add(event: TwinMindEvent, error: Error): Promise\u003Cvoid> {\n    const existing = this.queue.find(f => f.event.id === event.id);\n\n    if (existing) {\n      existing.attempts += 1;\n      existing.lastError = error.message;\n      existing.nextRetry = new Date(\n        Date.now() + this.baseDelayMs * Math.pow(2, existing.attempts)\n      );\n\n      if (existing.attempts >= this.maxRetries) {\n        \u002F\u002F Move to dead letter queue\n        await this.moveToDeadLetter(existing);\n        this.queue = this.queue.filter(f => f.event.id !== event.id);\n      }\n    } else {\n      this.queue.push({\n        event,\n        attempts: 1,\n        lastError: error.message,\n        nextRetry: new Date(Date.now() + this.baseDelayMs),\n      });\n    }\n  }\n\n  async processRetries(): Promise\u003Cvoid> {\n    const now = new Date();\n    const readyEvents = this.queue.filter(f => f.nextRetry \u003C= now);\n\n    for (const failedEvent of readyEvents) {\n      try {\n        await this.reprocessEvent(failedEvent.event);\n        this.queue = this.queue.filter(f => f.event.id !== failedEvent.event.id);\n        console.log(`Successfully reprocessed event: ${failedEvent.event.id}`);\n      } catch (error: any) {\n        await this.add(failedEvent.event, error);\n      }\n    }\n  }\n\n  private async reprocessEvent(event: TwinMindEvent): Promise\u003Cvoid> {\n    \u002F\u002F Re-dispatch to handlers\n    const handlers = getHandlersForEvent(event.type);\n    await Promise.all(handlers.map(h => h(event)));\n  }\n\n  private async moveToDeadLetter(failedEvent: FailedEvent): Promise\u003Cvoid> {\n    console.error(`Event ${failedEvent.event.id} moved to dead letter queue after ${failedEvent.attempts} attempts`);\n\n    \u002F\u002F Store in database for manual review\n    await db.deadLetterQueue.create({\n      event_id: failedEvent.event.id,\n      event_type: failedEvent.event.type,\n      payload: failedEvent.event,\n      attempts: failedEvent.attempts,\n      last_error: failedEvent.lastError,\n    });\n\n    \u002F\u002F Alert ops team\n    await notifySlack({\n      channel: '#alerts',\n      message: `:x: Webhook event failed after ${failedEvent.attempts} attempts: ${failedEvent.event.id}`,\n    });\n  }\n}\n\nexport const retryQueue = new WebhookRetryQueue();\n\n\u002F\u002F Start retry processor\nsetInterval(() => retryQueue.processRetries(), 60000);\n```\n\n## Output\n- Event type definitions\n- Webhook handler with signature verification\n- Event processing logic\n- Webhook registration script\n- Retry queue for failed events\n\n## Webhook Events Reference\n\n| Event | Description | Data |\n|-------|-------------|------|\n| `transcription.started` | Transcription job started | `transcript_id`, `audio_url` |\n| `transcription.completed` | Transcription finished | `transcript_id`, `duration`, `word_count` |\n| `transcription.failed` | Transcription failed | `transcript_id`, `error` |\n| `meeting.started` | Live meeting capture started | `meeting_id`, `title` |\n| `meeting.ended` | Meeting finished | `meeting_id`, `transcript_id`, `participants` |\n| `summary.generated` | AI summary ready | `summary_id`, `action_item_count` |\n| `action_items.extracted` | Action items available | `transcript_id`, `action_items[]` |\n| `usage.limit.warning` | Usage approaching limit | `percent_used`, `limit` |\n\n## Error Handling\n\n| Issue | Cause | Solution |\n|-------|-------|----------|\n| Invalid signature | Wrong secret | Verify webhook secret |\n| Event missed | Endpoint down | Implement retry queue |\n| Processing slow | Heavy handler | Use async queue |\n| Duplicate events | Retries | Implement idempotency |\n\n## Resources\n- [TwinMind Webhooks API](https:\u002F\u002Ftwinmind.com\u002Fdocs\u002Fwebhooks)\n- [Webhook Best Practices](https:\u002F\u002Ftwinmind.com\u002Fdocs\u002Fwebhook-best-practices)\n- [Event Reference](https:\u002F\u002Ftwinmind.com\u002Fdocs\u002Fevents)\n\n## Next Steps\nFor performance optimization, see `twinmind-performance-tuning`.\n",{"name":5,"author":48,"license":15,"version":49,"description":50,"allowed-tools":51},"Jeremy Longshore \u003Cjeremy@intentsolutions.io>","1.0.0","Handle TwinMind webhooks and events for real-time meeting notifications.\nUse when implementing webhook handlers, processing meeting events,\nor building real-time integrations.\nTrigger with phrases like \"twinmind webhooks\", \"twinmind events\",\n\"twinmind notifications\", \"meeting webhook handler\".\n","Read, Write, Edit, Bash(npm:*), Grep","main","90b50ed0778745a80fd5bfb13b1843d45b9e82f7","tests\u002Fext_conformance\u002Fartifacts\u002Fplugins-community\u002Fplugins\u002Fsaas-packs\u002Ftwinmind-pack\u002Fskills\u002Ftwinmind-webhooks-events",233,"https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust","https:\u002F\u002Fgithub.com\u002FDicklesworthstone","https:\u002F\u002Fwww.jeffreyemanuel.com\u002F","Building in NY","2026-11-15 01:54:15",{"source":8,"skillName":5,"commands":62,"prompt":72,"zipAvailable":73},[63,66,69],{"tool":64,"command":65},"npx","npx skills add Dicklesworthstone\u002Fpi_agent_rust --skill twinmind-webhooks-events",{"tool":67,"command":68},"bunx","bunx skills add Dicklesworthstone\u002Fpi_agent_rust --skill twinmind-webhooks-events",{"tool":70,"command":71},"pnpm","pnpm dlx skills add Dicklesworthstone\u002Fpi_agent_rust --skill twinmind-webhooks-events","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Fplugins-community\u002Fplugins\u002Fsaas-packs\u002Ftwinmind-pack\u002Fskills\u002Ftwinmind-webhooks-events\u002FSKILL.md",true,[],[76,109,143,166,192,218],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":80,"licenseFileUrl":81,"sourceHtmlUrl":82,"categories":83,"keywords":89,"publishedAt":108},"01M6FCR7G5A005P364Z6ZWCJDP","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 colors\u002Ffonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fcreative-design\u002Ftheme-factory\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fcreative-design\u002Ftheme-factory\u002FSKILL.md",[84],{"categoryNo":85,"categoryName":86,"taxonomyType":87,"taxonomyTypeDesc":88},"01JBSEEDCAT000000000000015","视觉设计","SCENARIO","使用场景",[90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,28,106,107],"theme factory","factory","theme","docs","toolkit","generate","artifacts","SET","fly","slides","landing","html","styling","artifact","pages","themes","you","fonts","2026-11-11 15:11:14",{"skillNo":110,"name":111,"nameZh":6,"description":112,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":80,"licenseFileUrl":113,"sourceHtmlUrl":114,"categories":115,"keywords":119,"publishedAt":43},"01M6FEGPPK0ZTKCCM0R3E3KS33","web-artifacts-builder","Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn\u002Fui). Use for complex artifacts requiring state management, routing, or shadcn\u002Fui components - not for simple single-file HTML\u002FJSX artifacts.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Futilities\u002Fweb-artifacts-builder\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Futilities\u002Fweb-artifacts-builder\u002FSKILL.md",[116],{"categoryNo":117,"categoryName":118,"taxonomyType":87,"taxonomyTypeDesc":88},"01JBSEEDCAT000000000000009","前端开发",[120,121,96,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,35,101,137,138,139,140,25,141,142],"web artifacts builder","web","artifacts builder","builder","frontend","css","components","react","component","routing","state management","state","shadcn","file","ui","Tools","Tailwind","single-file","simple","ui components","multi","jsx","suite",{"skillNo":144,"name":145,"nameZh":6,"description":146,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":80,"licenseFileUrl":147,"sourceHtmlUrl":148,"categories":149,"keywords":154,"publishedAt":43},"01M6FEE9VTK1W4GY21AKREJXRG","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fsecurity\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fsecurity\u002Fwebapp-testing\u002FSKILL.md",[150,153],{"categoryNo":151,"categoryName":152,"taxonomyType":87,"taxonomyTypeDesc":88},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":117,"categoryName":118,"taxonomyType":87,"taxonomyTypeDesc":88},[155,156,157,124,158,159,121,160,94,161,134,162,163,164,165,28,25],"testing","webapp testing","webapp","screenshots","playwright","debugging","browser","logs","applications","behavior","local",{"skillNo":167,"name":168,"nameZh":6,"description":169,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":170,"sourceHtmlUrl":171,"categories":172,"keywords":173,"publishedAt":43},"01M6FE20F7ZTQBFWKF4MPJ2SBX","neuropixels-analysis","Neuropixels neural recording analysis. Load SpikeGLX\u002FOpenEphys data, preprocess, motion correction, Kilosort4 spike sorting, quality metrics, Allen\u002FIBL curation, AI-assisted visual analysis, for Neuropixels 1.0\u002F2.0 extracellular electrophysiology. Use when working with neural recordings, spike sorting, extracellular electrophysiology, or when the user mentions Neuropixels, SpikeGLX, Open Ephys, Kilosort, quality metrics, or unit curation.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fneuropixels-analysis\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fneuropixels-analysis\u002FSKILL.md",[],[174,175,176,177,178,179,180,181,35,182,183,184,185,186,187,188,28,189,190,191,25,23],"analysis","neuropixels analysis","spike","metrics","data","open","quality","user","recordings","Neural","motion","visual","quality metrics","unit","sorting","curation","recording","load",{"skillNo":193,"name":194,"nameZh":6,"description":195,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":80,"licenseFileUrl":196,"sourceHtmlUrl":197,"categories":198,"keywords":202,"publishedAt":43},"01M6FDP0PDK6F1GGX395C7625Z","skill-creator","Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fskill-creator\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fskill-creator\u002FSKILL.md",[199],{"categoryNo":200,"categoryName":201,"taxonomyType":87,"taxonomyTypeDesc":88},"01JBSEEDCAT000000000000023","Skill与智能体开发",[203,204,205,206,207,208,209,210,40,211,212,213,214,215,28,25,216,23,217],"skill creator","creator","workflows","create","update","capabilities","knowledge","tool","specialized","guide","new skill","existing skill","users","Existing","new",{"skillNo":219,"name":220,"nameZh":6,"description":221,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":222,"sourceHtmlUrl":223,"categories":224,"keywords":226,"publishedAt":43},"01M6FDM8Y7VK7NYG9SM7QPA3PW","notebooklm","Use this skill to query your Google NotebookLM notebooks directly from Claude Code for source-grounded, citation-backed answers from Gemini. Browser automation, library management, persistent auth. Drastically reduced hallucinations through document-only responses.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fnotebooklm\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fnotebooklm\u002FSKILL.md",[225],{"categoryNo":200,"categoryName":201,"taxonomyType":87,"taxonomyTypeDesc":88},[220,227,228,229,230,231,232,161,233,234,35,235,236,237,238,25,239],"google","browser automation","gemini","automation","auth","code","library","management","only","document","query","Citation","source"]