إرسال رسائل تفاعلية على WhatsApp
تعلّم كيفية إرسال رسائل الأزرار ورسائل القوائم لبناء تجارب محادثة تفاعلية وجذابة على WhatsApp بخطوات عملية مباشرة.
المتطلبات الأساسية
قناة WhatsApp متصلة
أكمل دليل إعداد WhatsApp ربط WhatsApp Business API
محادثة نشطة
ضمن نافذة المراسلة لمدة 24 ساعة، أو قالب معتمد
مفتاح API (للاستخدام البرمجي)
قم بإنشائه في الإعدادات ← رموز API Settings → API Tokens
نافذة الجلسة لمدة 24 ساعة
فهم الرسائل التفاعلية
يدعم WhatsApp نوعين من الرسائل التفاعلية:
رسائل الأزرار
أزرار رد سريع للخيارات البسيطة. حتى 3 أزرار لكل رسالة.
- • الأفضل لـ: نعم/لا، تأكيد/إلغاء
- • الحد الأقصى للأزرار: 3
- • الحد الأقصى لعنوان الزر: 20 حرفًا
رسائل القوائم
قائمة قابلة للتوسيع مع خيارات مصنفة. حتى 10 عناصر عبر الأقسام.
- • الأفضل لـ: القوائم، الكتالوجات، الخيارات المتعددة
- • الحد الأقصى للأقسام: 10
- • إجمالي الصفوف الأقصى: 10
الطريقة 1: استخدام لوحة التحكم
افتح محادثة
انتقل إلى المحادثات وافتح محادثة WhatsApp نشطة. تأكد من أن المحادثة ضمن نافذة الـ 24 ساعة (سترى مؤشرًا أخضر).
انقر فوق زر الرسالة التفاعلية
في محرر الرسائل، انقر على أيقونة الشبكة (⊞) لفتح منشئ الرسائل التفاعلية. هذا يفتح نموذجًا حيث يمكنك تكوين رسالتك.
حدد نوع الرسالة
اختر بين رسالة بأزرار أو رسالة قائمة. سيتم تحديث النموذج لعرض الحقول ذات الصلة لنوعك المحدد.
قم بتكوين رسالتك
املأ تفاصيل الرسالة:
- الرأس (اختياري): رأس نصي أو صورة
- النص الأساسي: نص الرسالة الرئيسي
- التذييل (اختياري): نص صغير أسفل النص
- الأزرار/عناصر القائمة: قم بتكوين عناصرك التفاعلية
معاينة وإرسال
راجع المعاينة على الجانب الأيمن من المنشئ، ثم انقر على إرسال. سيتم تسليم الرسالة للعميل على الفور.
الطريقة 2: استخدام API
إرسال رسائل الأزرار
رسائل الأزرار مثالية للخيارات البسيطة مثل التأكيدات:
const response = await fetch('https://api.sendseven.com/api/v1/messages/send/interactive', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
channel_id: 'channel_wa_001',
contact_id: 'contact_xyz789',
type: 'buttons',
body: 'Would you like to proceed with your order?',
buttons: [
{ id: 'confirm', title: 'Yes, confirm' },
{ id: 'cancel', title: 'No, cancel' }
]
})
});إظهار مثال Python
import requests
response = requests.post(
'https://api.sendseven.com/api/v1/messages/send/interactive',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
json={
'channel_id': 'channel_wa_001',
'contact_id': 'contact_xyz789',
'type': 'buttons',
'body': 'Would you like to proceed with your order?',
'buttons': [
{'id': 'confirm', 'title': 'Yes, confirm'},
{'id': 'cancel', 'title': 'No, cancel'}
]
}
)إظهار مثال cURL
curl -X POST 'https://api.sendseven.com/api/v1/messages/send/interactive' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"channel_id": "channel_wa_001",
"contact_id": "contact_xyz789",
"type": "buttons",
"body": "Would you like to proceed with your order?",
"buttons": [
{"id": "confirm", "title": "Yes, confirm"},
{"id": "cancel", "title": "No, cancel"}
]
}'إرسال رسائل القوائم
رسائل القوائم مثالية للقوائم وكتالوجات الخدمات أو الخيارات المتعددة:
const response = await fetch('https://api.sendseven.com/api/v1/messages/send/interactive', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
channel_id: 'channel_wa_001',
contact_id: 'contact_xyz789',
type: 'list',
header: { type: 'text', text: 'Select a Service' },
body: 'Choose from our available services:',
footer: 'Tap to see options',
button_text: 'View Services',
sections: [
{
title: 'Support',
rows: [
{ id: 'tech_support', title: 'Technical Support', description: 'Get help with technical issues' },
{ id: 'billing', title: 'Billing Inquiry', description: 'Questions about your bill' }
]
},
{
title: 'Sales',
rows: [
{ id: 'demo', title: 'Request Demo', description: 'Schedule a product demo' },
{ id: 'pricing', title: 'Get Pricing', description: 'Request a custom quote' }
]
}
]
})
});إظهار مثال Python
import requests
response = requests.post(
'https://api.sendseven.com/api/v1/messages/send/interactive',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
json={
'channel_id': 'channel_wa_001',
'contact_id': 'contact_xyz789',
'type': 'list',
'header': {'type': 'text', 'text': 'Select a Service'},
'body': 'Choose from our available services:',
'footer': 'Tap to see options',
'button_text': 'View Services',
'sections': [
{
'title': 'Support',
'rows': [
{'id': 'tech_support', 'title': 'Technical Support', 'description': 'Get help with technical issues'},
{'id': 'billing', 'title': 'Billing Inquiry', 'description': 'Questions about your bill'}
]
},
{
'title': 'Sales',
'rows': [
{'id': 'demo', 'title': 'Request Demo', 'description': 'Schedule a product demo'},
{'id': 'pricing', 'title': 'Get Pricing', 'description': 'Request a custom quote'}
]
}
]
}
)معالجة استجابات المستخدم
عندما ينقر المستخدم على زر أو يحدد عنصر قائمة، ستتلقى حدث webhook:
// message.received, data.message when a user taps a button
{
"message_type": "interactive",
"text": "Yes, confirm",
"attachments": [
{
"type": "button_reply",
"button_id": "confirm",
"button_title": "Yes, confirm"
}
],
"meta": {
"button": { "id": "confirm", "payload": "confirm", "text": "Yes, confirm" }
}
}
// message.received, data.message when a user selects a list item
{
"message_type": "interactive",
"text": "Technical Support\nGet help with technical issues",
"attachments": [
{
"type": "list_reply",
"list_id": "tech_support",
"list_title": "Technical Support",
"list_description": "Get help with technical issues"
}
],
"meta": {
"button": {
"id": "tech_support",
"payload": "tech_support",
"text": "Technical Support",
"list_title": "Technical Support",
"list_description": "Get help with technical issues"
}
}
}معالجة الاستجابة
حل المشكلات
خطأ "انتهت صلاحية الجلسة"▼
أغلقت نافذة المراسلة لمدة 24 ساعة. يحتاج العميل إلى إرسال رسالة أولاً، أو يمكنك استخدام قالب رسالة لإعادة التواصل معهم.
الأزرار لا تظهر▼
تحقق من:
- عناوين الأزرار 20 حرفًا أو أقل
- لديك 3 أزرار على الأكثر
- كل زر لديه معرف فريد
- نص الرسالة ليس فارغًا
القائمة لا تتوسع▼
تأكد من تعيين button_text. هذا هو النص الذي يظهر على الزر الذي يفتح القائمة.
الخطوات التالية
الأسئلة الشائعة
لماذا لا يتم إرسال رسالتي التفاعلية؟
كم زرًا يمكن أن تحتوي الرسالة الواحدة، وما طول العنوان المسموح به؟
هل يمكنني إرسال الأزرار والقوائم على قنوات غير WhatsApp؟
هل تحتاج الرسائل التفاعلية إلى موافقة Meta؟
هل تعمل الرسائل التفاعلية على رقم متصل عبر WhatsApp Coexistence؟
كيف أعرف أي زر أو عنصر قائمة اختاره العميل؟
هل يستطيع Flow إرسال رسائل تفاعلية تلقائيًا؟
أدلة ذات صلة
هل أنت مستعد للبدء؟
ابدأ مع 100 رسالة تجريبية. وصول كامل خلال الفترة التجريبية. لا حاجة لبطاقة ائتمان.