Spaces:
Running
Running
axeronis
feat: Unified AI Brain 2.0 (Merged Knowledge Base & Persona, Removed /knowledge routes)
20ee727 Download backend/scripts/test_meta_ig.py from axeronis/microfunnel-api: direct link, hf CLI and curl.
- Browser
- Download file 1.15 kB
-
https://huggingface.co/spaces/axeronis/microfunnel-api/resolve/main/backend/scripts/test_meta_ig.py
- Command line
-
hf download hf://spaces/axeronis/microfunnel-api/backend/scripts/test_meta_ig.py
-
curl -L -o test_meta_ig.py https://huggingface.co/spaces/axeronis/microfunnel-api/resolve/main/backend/scripts/test_meta_ig.py
1.15 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_instagram import get_instagram_graph_service | |
| from app.models.tenant import Tenant | |
| async def test_send_ig(): | |
| print("π Testing Meta Instagram Graph API...") | |
| # MOCK Tenant | |
| tenant = Tenant( | |
| business_name="Test Business", | |
| meta_ig_config={ | |
| "page_id": "YOUR_FACEBOOK_PAGE_ID", | |
| "access_token": "YOUR_PAGE_ACCESS_TOKEN" | |
| } | |
| ) | |
| service = get_instagram_graph_service() | |
| recipient_id = input("Enter IG User ID (PSID): ") | |
| if not recipient_id: | |
| print("β Recipient ID required.") | |
| return | |
| try: | |
| print(f"π€ Sending DM to {recipient_id}...") | |
| response = await service.send_message( | |
| tenant=tenant, | |
| recipient_id=recipient_id, | |
| text="Hello from MicroFunnel Studio (Official IG API)! πΈ" | |
| ) | |
| print("β Success!", response) | |
| except Exception as e: | |
| print(f"β Failed: {e}") | |
| if __name__ == "__main__": | |
| asyncio.run(test_send_ig()) | |