NOTICE: All information contained herein is, and remains
the property of TechnoCore Automate.
ObjHook is a specialized subclass of ObjApi.ObjApi that handles
all webhook-related operations in Axion. It manages outbound and
inbound webhooks: reading webhook definitions from the database,
preparing payloads from parameters and SQL lookups, encoding
structured request bodies, and executing HTTP calls with retry
logic.
The companion class HookSet (in the same module) extends
ObjSupervisor.Supervisor and orchestrates sets of hooks,
typically invoked by the workflow engine or the hook micro-service.
Inherits from ObjApi.ObjApi. Core webhook execution engine.
Key attributes set during read():
_Webhookcode -- webhook identifier_Httpmethod -- GET, POST, PUT, PATCH, SERVICE_Baseurl -- target endpoint URL (supports patch_param_Payloadtype -- FORM, JSON, XML, DOCUMENT, SERVICE, REST_Hooklookupsql -- SQL used to fetch payload data_remote_connection -- optional remote DB for payload queriesParam1 .. Param9 -- positional parameters passed to the hookKey methods:
| Method | Purpose |
|---|---|
read() |
Load webhook definition and parameters from def_webhook / def_webhook_parameters by code |
prep_data() |
Build the outbound payload: run the lookup SQL, resolve parameters, populate param_value dict |
call() |
Execute the webhook: calls prep_data, validates, then dispatches via the appropriate HTTP method |
process_param() |
Cast a single parameter value to its declared type (ParamType) |
encode_struct() |
Recursively build a nested OrderedDict payload from the parameter hierarchy (Block / SubBlock / SubSubBlock) |
encode_as_struct() |
Wrapper that calls encode_struct at a given nesting level |
patch_param() |
Replace $param$ placeholders in any text with live parameter values (recursive, max depth) |
pre_stage() |
Mark a staging record as in-progress before execution |
ValidatePayload() |
Run def_webhook_validations rules against the assembled payload |
categorise_payload_out() |
Split parameters into header, query-string, and body buckets |
bloom_return() |
Parse and store the API response back into database columns |
parse_data() |
Safely parse a JSON or XML response string into a dict |
factory_hook() |
Dynamically import and call a Python module as a hook |
log_webhook_request() |
Record the outbound request to the metrics/staging table |
log_webhook_response() |
Record the API response to the metrics/staging table |
record_metric() |
Write a timing metric for the hook call |
HTTP dispatch (called internally by call()):
| Method | Protocol |
|---|---|
_execute_post_request() |
POST |
_execute_get_request() |
GET |
_execute_put_request() |
PUT |
_execute_with_retry() |
Wraps any HTTP method with exponential backoff (configurable via WebhookConfig) |
_execute_service_call() |
Internal service-to-service call |
Inherits from ObjSupervisor.Supervisor. Manages a batch of
webhook calls for a single workflow step or micro-service request.
| Method | Purpose |
|---|---|
Create() |
Build the supervisor and initialise state |
read() |
Load all hooks for a guid or context, iterate and call each one |
export_openapi() |
Generate an OpenAPI 3.0 spec for one or all webhooks |
pre_call() |
Pre-processing before the hook batch runs |
run_direct() |
Execute the hook set synchronously |
launch_service() |
Start as a long-running supervised service |
micro_service() |
Handle a single micro-service invocation |
| Class | Purpose |
|---|---|
WebhookConfig |
Constants: timeouts, retry limits, context prefixes |
Queries(StrEnum) |
Named keys for SQL queries stored in ObjHook.yaml |
ErrorMessage(StrEnum) |
Standardised error strings |
Parameter CRUD, supplement, and export operations live in
factory.core/extend.edit/ObjHookEdit.py. ObjHookEdit inherits
from ObjHook and adds:
| Method | Purpose |
|---|---|
load() |
Load full webhook config as a dict (definition + parameters + validations) |
save() |
Persist a webhook config dict back to the database |
delete_webhook() |
Remove a webhook and its parameters/validations |
export_to_file() |
Export webhook definition to YAML / JSON |
export_to_postman() |
Export as a Postman collection |
export_to_markdown() |
Export as Markdown documentation |
export_all_formats() |
Export to all supported formats at once |
import_from_file() |
Import webhook definition from YAML / JSON |
supplement_inbound_parameters() |
Auto-create parameters from a JSON sample |
supplement_parameters_from_sql() |
Auto-create parameters from SQL column headings |
Inspect webhooks and HTTP requests for testing. Get a URL to
collect HTTP or webhook requests and inspect them in a
human-friendly way. Optionally connect APIs, run code and return
a custom response on each request.
Test endpoint dashboard
Test endpoint URL
cythonize -3 -a -i ObjHook.py
Compiling /home/axion/projects/axion/factory.core/ObjHook.py because it changed..[1/1] Cythonizing /home/axion/projects/axion/factory.core/ObjHook.py
Updated : 2025-09-10