import asyncio import httpx import uuid async def test_webhook(): # Use a valid UUID to avoid 422 if validation is strict tenant_id = str(uuid.uuid4()) url = f"http://localhost:8000/api/v1/webhook/evolution/{tenant_id}" print(f"Testing URL: {url}") try: async with httpx.AsyncClient() as client: # Send an empty JSON or minimal payload response = await client.post(url, json={"type": "test"}) print(f"Status Code: {response.status_code}") print(f"Response: {response.text}") if response.status_code == 404: print("❌ Endpoint NOT FOUND (404)") elif response.status_code == 405: print("❌ Method Not Allowed (405) - Check if POST is correct") elif response.status_code == 400: print("✅ Endpoint exists (400 Bad Request is expected for invalid payload)") elif response.status_code == 422: print("✅ Endpoint exists (422 validation error is expected)") elif response.status_code == 200: print("✅ Endpoint works!") else: print(f"⚠️ Unexpected status: {response.status_code}") except Exception as e: print(f"❌ Connection failed: {e}") if __name__ == "__main__": asyncio.run(test_webhook())