Goal

Send a Slack alert if the buyer’s signature is missing from the document.

Input

Structured JSON output from Tensorlake (with signature detection enabled).

Output

Slack message to notify a team.
import json
import os
import requests

def notify_slack(msg):
    webhook_url = os.getenv("SLACK_WEBHOOK_URL")
    requests.post(webhook_url, json={"text": msg})

with open("output/signature-check.json") as f:
    data = json.load(f)

buyer = data["outputs"]["structured_data"]["pages"][0]["data"].get("buyer", {})
if not buyer.get("buyer_signed"):
    name = buyer.get("buyer_name", "Unknown")
    notify_slack(f"🚨 Buyer {name} has not signed the document.")