@meego-harness/event-sdk
v0.9.0
Published
Meego event webhook SDK based on Hono
Readme
@meego-harness/event-sdk
event-sdk is the raw Meego webhook layer. It verifies incoming webhook requests, deduplicates events by idempotent_key, maps event type codes to typed handlers, and exposes the underlying Hono app for embedding.
Use this package when you only need Meego webhook handling. Use @meego-harness/sdk when you also need harness projects, HITL, worker orchestration, storage, or audited OpenAPI calls.
Install
pnpm add @meego-harness/event-sdk honoBasic Usage
import { MeegoEventSDK } from '@meego-harness/event-sdk'
const sdk = new MeegoEventSDK({
pluginId: process.env.MEEGO_PLUGIN_ID,
token: process.env.MEEGO_WEBHOOK_TOKEN,
pluginSecret: process.env.MEEGO_PLUGIN_SECRET,
})
sdk.onWorkItemCreate((ctx) => {
console.log(ctx.payload.name)
})
await sdk.listen(3000)The default webhook path is /webhook; /health is registered on the same Hono app.
Embedding In Another Hono App
import { MeegoEventSDK } from '@meego-harness/event-sdk'
import { Hono } from 'hono'
const app = new Hono()
const sdk = new MeegoEventSDK({
app,
path: '/meego/webhook',
pluginId: process.env.MEEGO_PLUGIN_ID,
token: process.env.MEEGO_WEBHOOK_TOKEN,
})
sdk.onAny((ctx) => {
console.log(ctx.header.event_type)
})
export default appEvent Handlers
The SDK exports typed payloads and handler helpers for work item, workflow node, task, space, and timed trigger events. Handlers can be registered with or without an EventFilter:
sdk.onWorkItemUpdate({ projectKey: 'example-space' }, async (ctx) => {
console.log(ctx.header.uuid)
})Use onAny() for audit or logging, and onError() for central handler error reporting.
Configuration
| Option | Meaning |
| --- | --- |
| pluginId | Required when token is set. Used in signature verification. |
| token | Callback token from Meego event listener configuration. Enables signature verification when set. |
| pluginSecret | Optional plugin secret kept for integrations that need it. |
| path | Webhook path, default /webhook. |
| app | Custom Hono instance for embedding. |
| idempotencyStore | Optional custom idempotency store. |
| idempotencyCapacity / idempotencyTTL | Defaults for the in-memory LRU idempotency store. |
| enableLogger | Enables Hono request logging, default true. |
| onSignatureError | Receives raw body and error text when signature verification fails. |
Boundaries
- This package does not create harness projects or HITL records.
- This package does not own worker transport.
- This package does not call Meego OpenAPI.
- Idempotency defaults to process memory; use a custom
idempotencyStorefor multi-process deployments.
