Skip to main content

SDK for developing Hookline-compatible plugins with decorators and version registry

Project description

✅ Plugin Definition Guide

📦 Overview

All Hookline-compatible plugins must include:

  • config.json — Plugin metadata and user-configurable schema
  • execution.py — Defines a class-based plugin implementation using the hookline-sdk

📁 Files Required

1. config.json

Defines plugin metadata and config schema.

Example:

{
  "name": "Email Sender",
  "slug": "email_sender",
  "description": "Sends an email notification to a specified address.",
  "version": "1.0",
  "author": "Hookline",
  "icon": "https://yourdomain.com/assets/email_icon.png",
  "config_schema": {
    "to": {
      "type": "string",
      "required": true,
      "description": "Recipient email address"
    },
    "subject": {
      "type": "string",
      "required": true,
      "description": "Email subject"
    },
    "body": {
      "type": "string",
      "required": true,
      "description": "Email body. Supports placeholders like {event_type}, {task_id}"
    }
  }
}

2. execution.py

Defines plugin logic using the hookline-sdk.

✅ Structure Requirements:

  • You must subclass HooklinePlugin from hookline_sdk.base.

  • Define your execution methods inside the class.

  • Each versioned method must be decorated with @plugin_version("x.y.z").

  • The method name can be anything, but it must accept two arguments:

    • payload: dict
    • config: dict

🧩 Example Plugin Code (execution.py)

from hookline_sdk.base import HooklinePlugin
from hookline_sdk.registry import plugin_version

class EmailSenderPlugin(HooklinePlugin):

    @plugin_version("1.0")
    def send_email_v1(self, payload: dict, config: dict) -> dict:
        try:
            # Simulate email sending logic
            email_id = "email_abc123"
            timestamp = "2025-06-24T10:30:00Z"

            return {
                "status": "success",
                "message": "Email sent successfully.",
                "status_code": 200,
                "output": {
                    "email_id": email_id,
                    "sent_at": timestamp
                }
            }

        except Exception as e:
            return {
                "status": "failed",
                "message": f"Error: {str(e)}",
                "status_code": 500,
                "output": None
            }

🛠 Version Management

To support backward compatibility:

  • Every plugin function should be versioned using the @plugin_version("x.y.z") decorator.
  • When a plugin is upgraded, the old version's logic can still be retained using version-specific methods.

✅ Return Value Requirements

Each versioned function must return a dictionary in the following format:

{
  "status": "success" | "failed",
  "message": "Human-readable status",
  "status_code": 200,
  "output": { ... }  // Optional
}
Field Required Description
status "success" or "failed"
message Short explanation of the outcome
status_code Valid HTTP status code
output Dictionary containing plugin-specific result info

🔄 Lifecycle Flow

  1. User installs the plugin via Hookline's frontend (from the plugin marketplace).

  2. User provides configuration (as per config_schema in config.json).

  3. Workflow is triggered, and the plugin is invoked with the relevant:

    • payload (from the triggering event)
    • config (from user-specified settings)
  4. The matching versioned method is looked up from the class and executed.


⏱ Execution Constraints

Constraint Limit
Max Duration 60 seconds
Timeout Action Plugin will return timeout error
Retries Managed by workflow engine

📦 How to Use Hookline SDK

  • Add hookline-sdk as a dependency in your requirements.txt
  • To install from GitHub (for example):
pip install git+https://github.com/your-org/hookline-sdk.git

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hookline_sdk-0.1.1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hookline_sdk-0.1.1-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file hookline_sdk-0.1.1.tar.gz.

File metadata

  • Download URL: hookline_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for hookline_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6787c3517e202e2a14e9f4cc51b8bcce7eee98974ab2b79bfc76f5e7867f99e0
MD5 3d98dfc35d3b78b196b2ff70ac0f4bbe
BLAKE2b-256 c6057496b382a17ad4141256b00ef0f551c41eaf466d41d7aac5fd9aafc6a5ae

See more details on using hashes here.

File details

Details for the file hookline_sdk-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: hookline_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for hookline_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 007235e85100100da58510827db51600bdcf3b6a0562bec051b71b9f85c6f9ec
MD5 3e16760453cf2febafc69a3ea65ac250
BLAKE2b-256 9bf64ce23a1b7ee3834d6cfd3a69f6d3069d60deccd07547d9fdb1eb86f53100

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page