POST
/api/whatsapp/send/template🔒 Bearer JWTBody
| الحقل | النوع | الوصف |
|---|---|---|
to* | string | رقم المستلم. |
templateName* | string | اسم القالب كما هو في Meta. |
lang | string | رمز اللغة. افتراضي: en_US. عربي: ar. |
components | array | معاملات القالب (header / body / footer / buttons). |
templateContent | object | المحتوى الفعلي (body/footer/imageUrl) للحفظ في DB. |
مثال طلب
curl -X POST https://operix.operixdigital.com/api/whatsapp/send/template \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"to": "966500000000",
"templateName": "welcome_ar",
"lang": "ar",
"components": [
{
"type": "body",
"parameters": [
{ "type": "text", "text": "أحمد" }
]
}
]
}'القوالب المتاحة
لرؤية كل القوالب المعتمدة:
GET /api/whatsapp/templates. يجلبها مباشرة من Meta Business Account.مثال استجابة
{
"messaging_product": "whatsapp",
"contacts": [{ "input": "966500000000", "wa_id": "966500000000" }],
"messages": [{ "id": "wamid.HBgL..." }]
}Errors
| الكود | الرسالة | السبب |
|---|---|---|
| 401 | Unauthorized | |
| 500 | Template name does not exist | القالب غير معتمد أو اللغة خطأ. |
| 500 | Number of parameters mismatch | عدد {{n}} في القالب لا يطابق parameters. |