| name | palantir-webhooks-events |
| description | Implement Palantir Foundry webhook handling for Ontology change events.
Use when reacting to Ontology object changes, dataset updates,
or build completion events from Foundry.
Trigger with phrases like "palantir webhook", "foundry events",
"palantir notifications", "ontology change events".
|
| allowed-tools | Read, Write, Edit, Bash(curl:*) |
| version | 1.5.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","palantir","foundry","webhooks","events"] |
| compatibility | Designed for Claude Code, also compatible with Codex and OpenClaw |
Palantir Webhooks & Events
Overview
Handle Foundry webhook events for Ontology changes, dataset updates, and build completions. Covers webhook registration via the Foundry API, signature verification, event routing, and idempotent processing.
Prerequisites
- Foundry enrollment with webhook support enabled
- HTTPS endpoint accessible from Foundry's network
foundry-platform-sdk installed
Instructions
Step 1: Register a Webhook via API
import os, foundry
client = foundry.FoundryClient(
auth=foundry.ConfidentialClientAuth(
client_id=os.environ["FOUNDRY_CLIENT_ID"],
client_secret=os.environ["FOUNDRY_CLIENT_SECRET"],
hostname=os.environ["FOUNDRY_HOSTNAME"],
scopes=["api:read-data", "api:write-data"],
),
hostname=os.environ["FOUNDRY_HOSTNAME"],
)
webhook = client.webhooks.Webhook.create(
url="https://myapp.example.com/webhooks/foundry",
event_types=["ontology.object.created", "ontology.object.updated"],
secret="whsec_your_webhook_secret_here",
)
print(f"Webhook registered: {webhook.rid}")
Step 2: Webhook Endpoint with Signature Verification
from flask import Flask, request, jsonify
import hmac, hashlib
app = Flask(__name__)
@app.post("/webhooks/foundry")
def handle_foundry_webhook():
signature = request.headers.get("X-Foundry-Signature", "")
timestamp = request.headers.get("X-Foundry-Timestamp", "")
secret = os.environ["FOUNDRY_WEBHOOK_SECRET"]
signed_payload =
expected = hmac.new(
secret.encode(), signed_payload.encode(), hashlib.sha256
).hexdigest()
hmac.compare_digest(signature, expected):
jsonify({: }),
time
(time.time() - (timestamp)) > :
jsonify({: }),
event = request.get_json()
handle_event(event)
jsonify({: }),