#!/usr/bin/env python3
"""Test using the actual WhatsApp service class from the backend."""
import sys
import asyncio
from dotenv import load_dotenv

sys.path.insert(0, '.')
load_dotenv()

from whatsapp import WhatsAppService

async def test():
    service = WhatsAppService()
    
    print("Testing WhatsApp service with current token...")
    print(f"Token length: {len(service.access_token)}")
    print(f"Token (first 50): {service.access_token[:50]}")
    print(f"Token (last 50): {service.access_token[-50:]}")
    
    # Test with current parameters
    try:
        result = await service.send_wedding_invitation(
            to_phone="0504370045",
            guest_name="Dvir",
            partner1_name="החתן",
            partner2_name="הכלה",
            venue="הרמוניה בגן",
            event_date="15/06",
            event_time="18:30",
            guest_link="https://invy.dvirlabs.com/guest"
        )
        print(f"\n✅ SUCCESS!")
        print(f"Message ID: {result}")
    except Exception as e:
        print(f"\n❌ ERROR")
        print(f"Error: {str(e)}")

if __name__ == "__main__":
    asyncio.run(test())
