Implementation:0xSteph Pentest ai WebhookNotifier
| Knowledge Sources | |
|---|---|
| Domains | Webhooks, Notifications, Integration |
| Last Updated | 2026-10-23 00:00 GMT |
Overview
Concrete tool for sending webhook notifications to Slack, Jira, or generic HTTP endpoints when key engagement events occur, provided by the pentest-ai engine.
Description
The WebhookNotifier class sends HTTP POST notifications when configured events fire during an engagement. Supported events: engagement.started, engagement.completed, engagement.failed, finding.new, finding.critical, phase.started, phase.completed. Supports generic, Slack, and Jira webhook types. URL can be set via constructor or PENTEST_WEBHOOK_URL env var.
Usage
Import this class when you need to send engagement event notifications. Used by the orchestrator at phase and engagement boundaries.
Code Reference
Source Location
- Repository: 0xSteph_Pentest_ai
- File: engine/webhooks.py
- Lines: 1-99
Signature
VALID_EVENTS = frozenset({...})
class WebhookNotifier:
def __init__(
self,
url: str | None = None,
events: set[str] | None = None,
headers: dict[str, str] | None = None,
webhook_type: str = "generic",
): ...
def notify(self, event: str, payload: dict[str, Any]) -> bool: ...
Import
from engine.webhooks import WebhookNotifier, VALID_EVENTS
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| url | None | No | Webhook URL (defaults to PENTEST_WEBHOOK_URL env) |
| event | str | Yes | Event name from VALID_EVENTS |
| payload | dict | Yes | Event payload to send |
| webhook_type | str | No | "generic", "slack", or "jira" (default: "generic") |
Outputs
| Name | Type | Description |
|---|---|---|
| success | bool | True if notification was sent successfully |
Usage Examples
Send Webhook Notifications
from engine.webhooks import WebhookNotifier
notifier = WebhookNotifier(
url="https://hooks.slack.com/services/T0/B0/X",
webhook_type="slack",
)
notifier.notify("engagement.started", {"target": "example.com", "engagement_id": "abc"})
notifier.notify("finding.critical", {"title": "SQLi", "target": "https://example.com/search"})