agent-plugin-webhook / Exports / WebhookPlugin
Class: WebhookPlugin
Sends HTTP webhook notifications for agent execution lifecycle events.
Routes events to configured endpoints with optional event filtering per endpoint. Supports asynchronous delivery with configurable concurrency, automatic retries via WebhookHttpClient, and optional payload batching.
Lifecycle hooks used: AbstractPlugin.afterExecution | afterExecution, AbstractPlugin.afterConversation | afterConversation, AbstractPlugin.afterToolExecution | afterToolExecution, AbstractPlugin.onError | onError
See
- IWebhookPluginOptions - configuration options
- WebhookTransformer - payload transformation utilities
- WebhookHttpClient - HTTP delivery client
Example
const plugin = new WebhookPlugin({
endpoints: [{ url: 'https://example.com/hook' }],
async: true,
maxConcurrency: 3,
});Hierarchy
AbstractPlugin<IWebhookPluginOptions,IWebhookPluginStats>↳
WebhookPlugin
Table of contents
Constructors
Properties
Methods
- initialize
- subscribeToModuleEvents
- unsubscribeFromModuleEvents
- dispose
- enable
- disable
- isEnabled
- getConfig
- updateConfig
- getData
- clearData
- getStatus
- beforeRun
- afterRun
- beforeExecution
- beforeConversation
- beforeToolCall
- beforeToolExecution
- afterToolCall
- beforeProviderCall
- afterProviderCall
- onStreamingChunk
- onMessageAdded
- onModuleEvent
- afterExecution
- afterConversation
- afterToolExecution
- onError
- sendWebhook
- sendCustomWebhook
- getStats
- clearQueue
- destroy
Constructors
constructor
• new WebhookPlugin(options): WebhookPlugin
Parameters
| Name | Type |
|---|---|
options | IWebhookPluginOptions |
Returns
Overrides
AbstractPlugin<IWebhookPluginOptions, IWebhookPluginStats>.constructor
Defined in
agent-plugin-webhook/src/webhook-plugin.ts:99
Properties
enabled
• enabled: boolean
Inherited from
AbstractPlugin.enabled
Defined in
agent-core/dist/node/index.d.ts:1049
category
• category: PluginCategory
Inherited from
AbstractPlugin.category
Defined in
agent-core/dist/node/index.d.ts:1050
priority
• priority: number
Inherited from
AbstractPlugin.priority
Defined in
agent-core/dist/node/index.d.ts:1051
name
• name: string = 'WebhookPlugin'
Overrides
AbstractPlugin.name
Defined in
agent-plugin-webhook/src/webhook-plugin.ts:85
version
• version: string = '1.0.0'
Overrides
AbstractPlugin.version
Defined in
agent-plugin-webhook/src/webhook-plugin.ts:86
Methods
initialize
▸ initialize(options?): Promise<void>
Parameters
| Name | Type |
|---|---|
options? | IWebhookPluginOptions |
Returns
Promise<void>
Inherited from
AbstractPlugin.initialize
Defined in
agent-core/dist/node/index.d.ts:1063
subscribeToModuleEvents
▸ subscribeToModuleEvents(eventEmitter): Promise<void>
Parameters
| Name | Type |
|---|---|
eventEmitter | IEventEmitterPlugin |
Returns
Promise<void>
Inherited from
AbstractPlugin.subscribeToModuleEvents
Defined in
agent-core/dist/node/index.d.ts:1064
unsubscribeFromModuleEvents
▸ unsubscribeFromModuleEvents(eventEmitter): Promise<void>
Parameters
| Name | Type |
|---|---|
eventEmitter | IEventEmitterPlugin |
Returns
Promise<void>
Inherited from
AbstractPlugin.unsubscribeFromModuleEvents
Defined in
agent-core/dist/node/index.d.ts:1065
dispose
▸ dispose(): Promise<void>
Returns
Promise<void>
Inherited from
AbstractPlugin.dispose
Defined in
agent-core/dist/node/index.d.ts:1066
enable
▸ enable(): void
Returns
void
Inherited from
AbstractPlugin.enable
Defined in
agent-core/dist/node/index.d.ts:1067
disable
▸ disable(): void
Returns
void
Inherited from
AbstractPlugin.disable
Defined in
agent-core/dist/node/index.d.ts:1068
isEnabled
▸ isEnabled(): boolean
Returns
boolean
Inherited from
AbstractPlugin.isEnabled
Defined in
agent-core/dist/node/index.d.ts:1069
getConfig
▸ getConfig(): IPluginConfig
Returns
IPluginConfig
Inherited from
AbstractPlugin.getConfig
Defined in
agent-core/dist/node/index.d.ts:1070
updateConfig
▸ updateConfig(_config): void
Parameters
| Name | Type |
|---|---|
_config | IPluginConfig |
Returns
void
Inherited from
AbstractPlugin.updateConfig
Defined in
agent-core/dist/node/index.d.ts:1071
getData
▸ getData(): IPluginData
Returns
IPluginData
Inherited from
AbstractPlugin.getData
Defined in
agent-core/dist/node/index.d.ts:1072
clearData
▸ clearData(): void
Returns
void
Inherited from
AbstractPlugin.clearData
Defined in
agent-core/dist/node/index.d.ts:1073
getStatus
▸ getStatus(): Object
Returns
Object
| Name | Type |
|---|---|
name | string |
version | string |
enabled | boolean |
initialized | boolean |
category | PluginCategory |
priority | number |
subscribedEventsCount | number |
hasEventEmitter | boolean |
Inherited from
AbstractPlugin.getStatus
Defined in
agent-core/dist/node/index.d.ts:1074
beforeRun
▸ beforeRun(input, options?): Promise<void>
Parameters
| Name | Type |
|---|---|
input | string |
options? | IRunOptions |
Returns
Promise<void>
Inherited from
AbstractPlugin.beforeRun
Defined in
agent-core/dist/node/index.d.ts:1087
afterRun
▸ afterRun(input, response, options?): Promise<void>
Parameters
| Name | Type |
|---|---|
input | string |
response | string |
options? | IRunOptions |
Returns
Promise<void>
Inherited from
AbstractPlugin.afterRun
Defined in
agent-core/dist/node/index.d.ts:1088
beforeExecution
▸ beforeExecution(context): Promise<void>
Parameters
| Name | Type |
|---|---|
context | IPluginExecutionContext |
Returns
Promise<void>
Inherited from
AbstractPlugin.beforeExecution
Defined in
agent-core/dist/node/index.d.ts:1089
beforeConversation
▸ beforeConversation(context): Promise<void>
Parameters
| Name | Type |
|---|---|
context | IPluginExecutionContext |
Returns
Promise<void>
Inherited from
AbstractPlugin.beforeConversation
Defined in
agent-core/dist/node/index.d.ts:1091
beforeToolCall
▸ beforeToolCall(toolName, parameters): Promise<void>
Parameters
| Name | Type |
|---|---|
toolName | string |
parameters | TToolParameters |
Returns
Promise<void>
Inherited from
AbstractPlugin.beforeToolCall
Defined in
agent-core/dist/node/index.d.ts:1093
beforeToolExecution
▸ beforeToolExecution(context, toolData): Promise<void>
Parameters
| Name | Type |
|---|---|
context | IPluginExecutionContext |
toolData | IToolExecutionContext |
Returns
Promise<void>
Inherited from
AbstractPlugin.beforeToolExecution
Defined in
agent-core/dist/node/index.d.ts:1094
afterToolCall
▸ afterToolCall(toolName, parameters, result): Promise<void>
Parameters
| Name | Type |
|---|---|
toolName | string |
parameters | TToolParameters |
result | IToolExecutionResult |
Returns
Promise<void>
Inherited from
AbstractPlugin.afterToolCall
Defined in
agent-core/dist/node/index.d.ts:1095
beforeProviderCall
▸ beforeProviderCall(messages): Promise<void>
Parameters
| Name | Type |
|---|---|
messages | TUniversalMessage[] |
Returns
Promise<void>
Inherited from
AbstractPlugin.beforeProviderCall
Defined in
agent-core/dist/node/index.d.ts:1097
afterProviderCall
▸ afterProviderCall(messages, response): Promise<void>
Parameters
| Name | Type |
|---|---|
messages | TUniversalMessage[] |
response | TUniversalMessage |
Returns
Promise<void>
Inherited from
AbstractPlugin.afterProviderCall
Defined in
agent-core/dist/node/index.d.ts:1098
onStreamingChunk
▸ onStreamingChunk(chunk): Promise<void>
Parameters
| Name | Type |
|---|---|
chunk | TUniversalMessage |
Returns
Promise<void>
Inherited from
AbstractPlugin.onStreamingChunk
Defined in
agent-core/dist/node/index.d.ts:1099
onMessageAdded
▸ onMessageAdded(message): Promise<void>
Parameters
| Name | Type |
|---|---|
message | TUniversalMessage |
Returns
Promise<void>
Inherited from
AbstractPlugin.onMessageAdded
Defined in
agent-core/dist/node/index.d.ts:1101
onModuleEvent
▸ onModuleEvent(eventName, eventData): Promise<void>
Parameters
| Name | Type |
|---|---|
eventName | TEventName |
eventData | IEventEmitterEventData |
Returns
Promise<void>
Inherited from
AbstractPlugin.onModuleEvent
Defined in
agent-core/dist/node/index.d.ts:1102
afterExecution
▸ afterExecution(context, result): Promise<void>
Sends an execution-complete webhook after the agent finishes processing.
Parameters
| Name | Type |
|---|---|
context | IPluginExecutionContext |
result | IPluginExecutionResult |
Returns
Promise<void>
Overrides
AbstractPlugin.afterExecution
Defined in
agent-plugin-webhook/src/webhook-plugin.ts:157
afterConversation
▸ afterConversation(context, result): Promise<void>
Sends a conversation-complete webhook after a conversation round finishes.
Parameters
| Name | Type |
|---|---|
context | IPluginExecutionContext |
result | IPluginExecutionResult |
Returns
Promise<void>
Overrides
AbstractPlugin.afterConversation
Defined in
agent-plugin-webhook/src/webhook-plugin.ts:171
afterToolExecution
▸ afterToolExecution(context, toolResults): Promise<void>
Sends a tool-executed webhook for each tool call in the result set.
Parameters
| Name | Type |
|---|---|
context | IPluginExecutionContext |
toolResults | IPluginExecutionResult |
Returns
Promise<void>
Overrides
AbstractPlugin.afterToolExecution
Defined in
agent-plugin-webhook/src/webhook-plugin.ts:185
onError
▸ onError(error, context?): Promise<void>
Sends both an error-occurred and execution-error webhook on failure.
Parameters
| Name | Type |
|---|---|
error | Error |
context? | IPluginErrorContext |
Returns
Promise<void>
Overrides
AbstractPlugin.onError
Defined in
agent-plugin-webhook/src/webhook-plugin.ts:209
sendWebhook
▸ sendWebhook(event, data, metadata?): Promise<void>
Builds a webhook payload and delivers it to all matching endpoints. When batching is enabled, payloads are queued and flushed at the configured interval.
Parameters
| Name | Type |
|---|---|
event | TWebhookEventName |
data | IWebhookEventData |
metadata? | TWebhookMetadata |
Returns
Promise<void>
Defined in
agent-plugin-webhook/src/webhook-plugin.ts:232
sendCustomWebhook
▸ sendCustomWebhook(data, metadata?): Promise<void>
Sends a webhook with the custom event type.
Parameters
| Name | Type |
|---|---|
data | IWebhookEventData |
metadata? | TWebhookMetadata |
Returns
Promise<void>
Defined in
agent-plugin-webhook/src/webhook-plugin.ts:273
getStats
▸ getStats(): IWebhookPluginStats
Get webhook plugin statistics
Returns
IWebhookPluginStats
Overrides
AbstractPlugin.getStats
Defined in
agent-plugin-webhook/src/webhook-plugin.ts:444
clearQueue
▸ clearQueue(): void
Clear webhook queue
Returns
void
Defined in
agent-plugin-webhook/src/webhook-plugin.ts:463
destroy
▸ destroy(): Promise<void>
Flushes pending batches, clears request queues, and stops the batch timer.
Returns
Promise<void>