#!/usr/bin/env python3
"""
Check all available webhook endpoints
"""

import requests
import json

def test_webhook_endpoint(url, name):
    """Test a specific webhook endpoint"""
    payload = {"message": "Test message"}
    
    try:
        response = requests.post(url, json=payload, timeout=10)
        print(f"\n{name}:")
        print(f"  URL: {url}")
        print(f"  Status: {response.status_code}")
        
        if response.status_code == 200:
            data = response.json()
            print(f"  Success: {data.get('success', False)}")
            print(f"  Error: {data.get('error', 'None')}")
        elif response.status_code == 404:
            print(f"  Error: Webhook not registered")
        else:
            print(f"  Response: {response.text[:100]}...")
            
    except Exception as e:
        print(f"\n{name}:")
        print(f"  URL: {url}")
        print(f"  Error: {e}")

def main():
    """Test all possible webhook endpoints"""
    print("Checking Available Webhook Endpoints")
    print("=" * 50)
    
    webhooks = [
        ("http://localhost:5678/webhook/agent-task", "Original Webhook"),
        ("http://localhost:5678/webhook/agent-task-v2", "V2 Webhook"),
        ("http://localhost:5678/webhook/agent-task-corrected", "Corrected Webhook"),
        ("http://localhost:5678/webhook/agent-task-working", "Working Webhook"),
        ("http://localhost:5678/webhook/agent-task-final", "Final Webhook")
    ]
    
    for url, name in webhooks:
        test_webhook_endpoint(url, name)

if __name__ == "__main__":
    main()
