#428 App: Webhook Gateway (webhook_gateway)

closed high Created 2025-12-14 20:14 · Updated 2026-01-02 06:26

Description

Edit
## Overview Receive webhooks from external services, transform payloads, and forward to email/Slack/other destinations. ## App Metadata - **App Name:** webhook_gateway - **Publisher:** platform - **Version:** 1.0.0 - **Priority:** High - **Complexity:** Low - **Phase:** 1 (Quick wins for beta demo) ## Actions ### 1. process_webhook **Description:** Parse and validate incoming webhook payload **Parameters:** - payload (dict, required): Raw webhook payload - source (str, optional): Webhook source identifier (github|stripe|custom) - validate_signature (bool, default=False): Validate webhook signature - signature_header (str, optional): Header containing signature - secret_key (str, optional): Secret for signature validation **Returns:** { "parsed": true, "source": "github", "event_type": "push", "payload": {...}, "received_at": "2025-01-01T00:00:00Z" } ### 2. transform_payload **Description:** Transform payload using JSONPath or templates **Parameters:** - payload (dict, required): Payload to transform - template (str, required): Jinja2 template for output - extract_fields (dict, optional): JSONPath expressions to extract fields **Returns:** {"transformed": "...", "extracted_fields": {...}} ### 3. forward_to_email **Description:** Format payload and send via email **Parameters:** - payload (dict, required): Payload to send - recipient_email (str, required): Destination email - subject_template (str, default='Webhook: {{source}}'): Email subject - body_template (str, optional): Custom body template - format (str, default='html'): Email format (html|text|json) **Returns:** {"sent": true, "recipient": "...", "subject": "..."} ### 4. forward_to_slack **Description:** Post formatted message to Slack **Parameters:** - payload (dict, required): Payload to send - webhook_url (str, required): Slack incoming webhook URL - message_template (str, optional): Custom message template - channel (str, optional): Override channel - username (str, default='Highway Bot'): Bot username **Returns:** {"sent": true, "channel": "..."} ## Example Workflow - GitHub Push Notification builder = WorkflowBuilder(name='github_push_notify', version='1.0.0') builder.task( task_id='process', function='apps.platform.webhook_gateway.process_webhook', kwargs={ 'payload': '{{workflow_input}}', 'source': 'github' }, result_key='webhook_data' ) builder.task( task_id='notify_email', function='apps.platform.webhook_gateway.forward_to_email', kwargs={ 'payload': '{{webhook_data}}', 'recipient_email': 'dev@example.com', 'subject_template': 'GitHub: {{webhook_data.event_type}} on {{webhook_data.payload.repository.name}}' } ) ## Supported Webhook Sources (with parsers) - github: Push, PR, Issues, Releases - gitlab: Push, MR, Issues - stripe: Payment events - custom: Generic JSON ## Implementation Notes - Webhook receiver endpoint already exists in API - Focus on transformation and forwarding logic - Use Jinja2 for templating - Support HMAC signature validation for security - Log all received webhooks to DataShard ## Configuration Schema { "allowed_sources": ["github", "gitlab", "stripe", "custom"], "max_payload_size_kb": 1024, "signature_tolerance_seconds": 300 } ## Secrets Config { "github_webhook_secret": "vault:tenant/webhook_secrets:github", "stripe_webhook_secret": "vault:tenant/webhook_secrets:stripe", "slack_webhook_url": "vault:tenant/integrations:slack_webhook" } ## Dependencies - Jinja2 for templating - hmac/hashlib for signature validation - httpx for Slack webhook calls - Email sending (reuse SMTP config)

Comments

Loading comments...

Context

Loading context...

Audit History

View All
Loading audit history...