Time estimate: 60 minutes. Assumes familiarity with Python and the provider model.
What you’ll build
Awebhooks provider with a single resource type: endpoint. Users will be able to create webhook endpoints like this:
Step 1: Scaffold the project
Step 2: Define the schema
Deletesrc/webhooks_provider/resources/example.py and create src/webhooks_provider/resources/endpoint.py with your resource definition:
hooks.example.com stands in for the API of the webhooks service you integrate with; it is not a real service. Substitute your service’s endpoint and request format. The handlers show the shape of an observe-then-act provider and work only against a real service.endpoint.py
- Config defines what users provide.
Field[str]means a field that accepts either a direct value or a field reference from another resource. - Outputs defines what this resource exposes. Other resources can reference
endpoint_idordelivery_urlvia field references. - Lifecycle methods are observe-then-act.
on_observereports whether the endpoint exists, locating it from the resource identity and config alone; the platform then callson_createfor an absent endpoint andon_updatefor a present one.on_observeis mandatory: a resource without it fails to register. - Handlers await their I/O, here through
httpx.AsyncClient, and must be idempotent — repeating a handler with the same input produces the same result.
Step 3: Register the resource
Updatesrc/webhooks_provider/resources/__init__.py to export your resource:
__init__.py
src/webhooks_provider/__init__.py to register it with the provider:
__init__.py
Step 4: Publish and install
Publish the provider version, then install it in your organization:publish builds the wheel, extracts the resource schemas, and uploads both under <org>/webhooks, where <org> is your organization’s slug. install queues the provider for your organization, and the platform deploys it.
Step 5: Use it
Now users can create webhook endpoints as Pragmatiks resources:webhook.yaml
secret field uses a field reference — it pulls the value from a pragma/secret resource instead of hardcoding it. Other resources can reference this webhook’s outputs:
Deep dive
The Building Providers guide covers everything in detail:Getting Started
Full walkthrough of building a provider from scratch.
Config and Outputs
Schema design with validation, dependencies, and field references.
Lifecycle Methods
Implementing idempotent observe, create, update, and delete handlers.
Deployment
Publishing, installing, and deploying your provider.
Best Practices
Idempotency patterns, error handling, and production readiness.