Send Template Message

إرسال قالب معتمد من Meta — الطريقة الوحيدة لبدء محادثة.

POST/api/whatsapp/send/template🔒 Bearer JWT

Body

الحقلالنوعالوصف
to*stringرقم المستلم.
templateName*stringاسم القالب كما هو في Meta.
langstringرمز اللغة. افتراضي: en_US. عربي: ar.
componentsarrayمعاملات القالب (header / body / footer / buttons).
templateContentobjectالمحتوى الفعلي (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

الكودالرسالةالسبب
401Unauthorized
500Template name does not existالقالب غير معتمد أو اللغة خطأ.
500Number of parameters mismatchعدد {{n}} في القالب لا يطابق parameters.