واتساب
import requests
import os
# بيانات من البيئة (بلقور)
access_token = os.getenv("ACCESS_TOKEN")
phone_number_id = os.getenv("PHONE_NUMBER_ID")
# قائمة الأرقام (أدخلهم من ملف أو مباشرة هنا)
recipients = [
"966501234567",
"966502345678"
]
# نص الرسالة
message = "مرحبًا، هذا تذكير بخدمتكم معنا من شركة [اسمك] ✅"
# إرسال الرسالة لكل رقم
for number in recipients:
url = f"https://graph.facebook.com/v18.0/{phone_number_id}/messages"
payload = {
"messaging_product": "whatsapp",
"to": number,
"type": "text",
"text": {"body": message}
}
headers = {
"Authorization": f"Bearer {access_token}",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(f"📤 تم الإرسال إلى {number} - الحالة: {response.status_code}")