108 lines
No EOL
3.3 KiB
Python
108 lines
No EOL
3.3 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
WhatsApp Discovery Readiness Check
|
|
|
|
Checks if we're ready to run WhatsApp discovery tests.
|
|
Shows what would be tested once API token is available.
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
def check_readiness():
|
|
"""Check if we're ready for WhatsApp discovery."""
|
|
print("🔍 WhatsApp Discovery Readiness Check")
|
|
print("=" * 50)
|
|
|
|
# Check 1: API Token
|
|
token = os.getenv("WHATSAPP_BUSINESS_TOKEN")
|
|
if token:
|
|
print("✅ WHATSAPP_BUSINESS_TOKEN is set")
|
|
print(f" Token length: {len(token)} characters")
|
|
if token.startswith('EAAC'):
|
|
print("✅ Token appears to be a valid Facebook/WhatsApp Business token")
|
|
else:
|
|
print("⚠️ Token format unknown (should start with EAAC)")
|
|
else:
|
|
print("❌ WHATSAPP_BUSINESS_TOKEN is NOT set")
|
|
print("\nTo set up the token:")
|
|
print("1. Get token from Facebook Business API")
|
|
print("2. Run: export WHATSAPP_BUSINESS_TOKEN='your_token_here'")
|
|
print("3. Or add to .env file")
|
|
|
|
print()
|
|
|
|
# Check 2: Phone numbers to test
|
|
phone_numbers = [
|
|
{"name": "Bas Schreuder", "base": "3162940", "code": "31"},
|
|
{"name": "Bjorn de Jong", "base": "3161489", "code": "31"},
|
|
{"name": "Mylène Da Silva", "base": "3165313", "code": "31"}
|
|
]
|
|
|
|
print("📱 Phone Numbers Ready to Test:")
|
|
for i, p in enumerate(phone_numbers, 1):
|
|
full = f"{p['code']}{p['base']}XXXX"
|
|
print(f" {i}. {p['name']}: {full}")
|
|
|
|
print()
|
|
|
|
# Check 3: Test script exists
|
|
script_path = Path("whatsapp_discovery_simple.py")
|
|
if script_path.exists():
|
|
print("✅ WhatsApp discovery script exists")
|
|
print(" Script: whatsapp_discovery_simple.py")
|
|
print(" Method: 10 variations (last digit replacement)")
|
|
else:
|
|
print("❌ WhatsApp discovery script NOT found")
|
|
|
|
print()
|
|
|
|
# Show what will be tested
|
|
if token:
|
|
print("🚀 Ready to run discovery tests!")
|
|
print("\nCommands to run:")
|
|
for p in phone_numbers:
|
|
print(f" python whatsapp_discovery_simple.py {p['base']} {p['code']}")
|
|
print("\nEach test will:")
|
|
print(" - Test 10 phone number variations")
|
|
print(" - Store raw API responses")
|
|
print(" - Save results to timestamped JSON file")
|
|
print(" - Show immediate results for found accounts")
|
|
else:
|
|
print("⏸️ Waiting for API token setup...")
|
|
print("\nNext steps:")
|
|
print(" 1. Obtain WhatsApp Business API token")
|
|
print(" 2. Set WHATSAPP_BUSINESS_TOKEN environment variable")
|
|
print(" 3. Run discovery tests")
|
|
|
|
print()
|
|
print("📊 Expected Output Format:")
|
|
print("""
|
|
{
|
|
"test_metadata": {
|
|
"phone_base": "313162940XXXX",
|
|
"country_code": "31",
|
|
"test_date": "2025-01-12T...",
|
|
"method": "10_variations_last_digit_replacement",
|
|
"total_tested": 10
|
|
},
|
|
"raw_results": [
|
|
{
|
|
"phone": "3162940123",
|
|
"attempt": 1,
|
|
"status_code": 200,
|
|
"status": "success",
|
|
"exists": true,
|
|
"display_name": "Bas Schreuder",
|
|
"is_business": false,
|
|
"last_activity": "2025-01-10",
|
|
"raw_response": "{...full API response...}",
|
|
"headers": {...}
|
|
}
|
|
]
|
|
}
|
|
""")
|
|
|
|
if __name__ == "__main__":
|
|
check_readiness() |