Spaces:
Running
Running
axeronis
feat: Unified AI Brain 2.0 (Merged Knowledge Base & Persona, Removed /knowledge routes)
20ee727 Download backend/scripts/test_meta_wa.py from axeronis/microfunnel-api: direct link, hf CLI and curl.
- Browser
- Download file 1.25 kB
-
https://huggingface.co/spaces/axeronis/microfunnel-api/resolve/main/backend/scripts/test_meta_wa.py
- Command line
-
hf download hf://spaces/axeronis/microfunnel-api/backend/scripts/test_meta_wa.py
-
curl -L -o test_meta_wa.py https://huggingface.co/spaces/axeronis/microfunnel-api/resolve/main/backend/scripts/test_meta_wa.py
1.25 kB
| import asyncio | |
| import sys | |
| import os | |
| # Add backend to path | |
| sys.path.append(os.path.join(os.path.dirname(__file__), '..')) | |
| from app.services.meta_whatsapp import get_whatsapp_cloud_service | |
| from app.models.tenant import Tenant | |
| async def test_send(): | |
| print("π Testing Meta WhatsApp Cloud API...") | |
| # MOCK Tenant for testing (Replace with real tokens to test) | |
| # You can also fetch a real tenant from DB if you prefer | |
| tenant = Tenant( | |
| business_name="Test Business", | |
| meta_wa_config={ | |
| "phone_number_id": "YOUR_PHONE_ID", | |
| "access_token": "YOUR_ACCESS_TOKEN" | |
| } | |
| ) | |
| service = get_whatsapp_cloud_service() | |
| to_phone = input("Enter recipient phone number (e.g. 15551234567): ") | |
| if not to_phone: | |
| print("β Phone number required.") | |
| return | |
| try: | |
| print(f"π€ Sending message to {to_phone}...") | |
| response = await service.send_text_message( | |
| tenant=tenant, | |
| to_phone=to_phone, | |
| text="Hello from MicroFunnel Studio (Official API)! π" | |
| ) | |
| print("β Success!", response) | |
| except Exception as e: | |
| print(f"β Failed: {e}") | |
| if __name__ == "__main__": | |
| asyncio.run(test_send()) | |