الرسائل

/v1/messages

استخدم العقدة messages لإرسال النص والوسائط وجهات الاتصال والمواقع والرسائل التفاعلية بالإضافة إلى قوالب الرسائل إلى العملاء.

يمكنك الرجوع إلى الدلائل التالية للحصول على معلومات حول الأنواع المحددة للرسائل التي يمكنك إرسالها: الرسائل النصية ورسائل الوسائط ورسائل جهات الاتصال والموقع والرسائل التفاعلية وقوالب الرسائل وقوالب رسائل الوسائط وقوالب الرسائل التفاعلية.

قبل البدء

ستحتاج إلى ما يلي:

  • مصادقة نفسك والحصول على رمز المصادقة الذي يتيح لك الوصول إلى الخدمة. ولمزيد من المعلومات حول كيفية إجراء ذلك، يمكنك الرجوع إلى وثائق تسجيل الدخول والمصادقة.
  • للتحقق من حساب واتساب الذي تريد مراسلته والحصول على معرف مستخدم واتساب المرتبط به، راجع وثائق جهات الاتصال لمزيد من المعلومات حول كيفية إجراء ذلك.
  • تلبية متطلبات خدمة التحكم في الانقطاع للرسائل.

بدءًا من الإصدار 2.39 والإصدارات الأحدث، لا يتعين عليك استدعاء عقدة جهات الاتصال قبل إرسال الرسالة.

القيود

  • يتم دعم الأنواع التالية من الرسائل: النصوص وقوالب الرسائل والصور والمستندات والمقاطع الصوتية.
  • يمكن أن يصل طول الرسالة النصية إلى 4096 حرفًا كحد أقصى.

الإنشاء

يمكنك إرسال الرسائل من خلال إجراء استدعاء POST للعقدة /messages بغض النظر عن نوع الرسالة. ويختلف محتوى نص رسالة JSON حسب أنواع الرسائل (نص، صورة، وغير ذلك).

المعلمات

هذه هي المعلمات الرئيسية المستخدمة في طلبات POST لـ /messages:

الاسم الوصف

type

مطلوب لقوالب الرسائل.

نوع الرسالة التي يتم إرسالها.
وتتوفر الخيارات التالية:

  • text - افتراضي
  • image
  • audio
  • document
  • template - استخدام هذا لإرسال رسالة قالب وسائط
  • hsm

to

مطلوب.

معرف WhatsApp الذي يتم إرسال الرسالة إليه.

سيتم إيقاف استخدام ttl
في الإصدار v2.35

اختياري.

اعتبارًا من v2.21.3 — مدة البقاء (TTL).
افتراضي: 7 أيام
خيارات أخرى: تتراوح أقصى مدة مدعومة وأدنى مدة مدعومة بين يوم واحد و30 يومًا (شاملين).


يمكن قبول سلسلة بتنسيق المدة ISO-8601، وكذلك بالثواني. ويجب تحديد فترات المدة بدقة مع مضاعفة الأيام، ويتم تقريب أية قيم بينية تلقائيًا إلى أقرب يوم. ولمزيد من المعلومات، يمكنك الرجوع إلى قسم الكائن ttl.

recipient_type

اختياري.

القيمة:individual

template

مطلوب لرسائل template.

يمكن أن يحتوي على كل معلومات القالب.

hsm

مطلوب لقوالب الرسائل.

العنصر المُضمن في محتوى الرسالة. ويمكن الإشارة إلى أن الرسالة تتمتع ببنية محددة للغاية. وتوفر المعلمات المضمّنة البنية.

كائن النص

الاسمالوصف

body

مطلوب.

يحتوي على نص الرسالة التي يمكن أن تحتوي على عناوين URL وتنسيقات.

كائن الوسائط

بالنسبة لواجهة API داخل المواقع، يتم إرجاع معرف كائن الوسائط عند تحميل الوسائط بنجاح إلى عميل الواجهة داخل المواقع/المرجع في واتساب للأعمال من خلال نقطة النهاية media.

NameDescription

id

string

Required when type is audio, document, image, sticker, or video and you are not using a link.


The media object ID. Do not use this field when message type is set to text.

link

string

Required when type is audio, document, image, sticker, or video and you are not using an uploaded media ID (i.e. you are hosting the media asset on your public server).

The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URLs.


Do not use this field when message type is set to text.


Cloud API users only:


  • See Media HTTP Caching if you would like us to cache the media asset for future messages.
  • When we request the media asset from your server you must indicate the media's MIME type by including the Content-Type HTTP header. For example: Content-Type: video/mp4. See Supported Media Types for a list of supported media and their MIME types.

caption

string

Optional.


Media asset caption. Do not use with audio or sticker media.


On-Premises API users:

  • For v2.41.2 or newer, this field is is limited to 1024 characters.
  • Captions are currently not supported for document media.

filename

string

Optional.


Describes the filename for the specific document. Use only with document media.


The extension of the filename will specify what format the document is displayed as in WhatsApp.

provider

string

Optional. On-Premises API only.

This path is optionally used with a link when the HTTP/HTTPS link is not directly accessible and requires additional configurations like a bearer token. For information on configuring providers, see the Media Providers documentation.

كائن جهات الاتصال

داخل contacts، يمكنك تضمين الكائنات التالية: addresses وemails وname وorg وphone وurls. يجب أن يتم تضمين الكائنات المجمعة في مصفوفة كما هو موضح في المثال أدناه.

NameDescription

addresses

object

Optional.

Full contact address(es) formatted as an addresses object. The object can contain the following fields:

streetstringOptional. Street number and name.

citystringOptional. City name.

statestringOptional. State abbreviation.

zipstringOptional. ZIP code.

countrystringOptional. Full country name.

country_codestringOptional. Two-letter country abbreviation.

typestringOptional. Standard values are HOME and WORK.

birthday

Optional.

YYYY-MM-DD formatted string.

emails

object

Optional.

Contact email address(es) formatted as an emails object. The object can contain the following fields:

emailstringOptional. Email address.

typestringOptional. Standard values are HOME and WORK.

name

object

Required.

Full contact name formatted as a name object. The object can contain the following fields:

formatted_namestringRequired. Full name, as it normally appears.

first_namestringOptional*. First name.

last_namestringOptional*. Last name.

middle_namestringOptional*. Middle name.

suffixstringOptional*. Name suffix.

prefixstringOptional*. Name prefix.


*At least one of the optional parameters needs to be included along with the formatted_name parameter.

org

object

Optional.

Contact organization information formatted as an org object. The object can contain the following fields:

companystringOptional. Name of the contact's company.

departmentstringOptional. Name of the contact's department.

titlestringOptional. Contact's business title.

phones

object

Optional.

Contact phone number(s) formatted as a phone object. The object can contain the following fields:

phonestringOptional. Automatically populated with the `wa_id` value as a formatted phone number.

typestringOptional. Standard Values are CELL, MAIN, IPHONE, HOME, and WORK.

wa_idstringOptional. WhatsApp ID.

urls

object

Optional.

Contact URL(s) formatted as a urls object. The object can contain the following fields:

urlstringOptional. URL.

typestringOptional. Standard values are HOME and WORK.

مثال على كائن contacts يتضمن الكائنات المجمَّعة المتداخلة ضمن:

"contacts": [
    {
        "addresses": [
            {
                "city": "city name",
                "country": "country name",
                "country_code": "code",
                "state": "Contact's State",
                "street": "Contact's Street",
                "type": "Contact's Address Type",
                "zip": "Contact's Zip Code"
            }
        ],
        "birthday": "birthday",
        "emails": [
            {
                "email": "email",
                "type": "HOME"
            },
            {
                "email": "email",
                "type": "WORK"
            }
        ],
        "name": {
            "first_name": "first name value",
            "formatted_name": "formatted name value",
            "last_name": "last name value",
            "suffix": "suffix value"
        },
        "org": {
            "company": "company name",
            "department": "dep name",
            "title": "title"
        },
        "phones": [
            {
                "phone": "Phone number",
                "wa-id": "WA-ID value",
                "type": "MAIN"
            },
            {
                "phone": "Phone number",
                "type": "HOME"
            },
            {
                "phone": "Phone number",
                "type": "WORK"
            }
        ],
        "urls": [{
            "url": "some url",
            "type": "WORK"
        }]
    }
]

كائن الموقع

NameDescription

latitude

Required.

Location latitude in decimal degrees.

longitude

Required.

Location longitude in decimal degrees.

name

Required.

Name of the location.

address

Required.

Address of the location.

كائن القالب

داخل template، يمكنك تضمين كائنات components وlanguage.

بدءًا من الإصدار v2.27.8، يجب أن يمثل الحقل namespace الخاص بالقالب مساحة اسم مرتبطة بحساب واتساب للأعمال الذي يمتلك رقم الهاتف المتوفر في العميل الحالي داخل الموقع لحساب واتساب للأعمال. وبخلاف ذلك، سيتعذر إرسال الرسالة.

بالإضافة إلى ذلك، بدءًا من الإصدار v2.41 والإصدارات الأحدث، سيكون namespace حقلاً اختياريًا.

الاسمالوصف

namespace

مطلوب.

مساحة اسم القالب.


بداية من الإصدار v2.27.8، يجب أن يمثل ذلك مساحة الاسم المرتبطة بحساب WhatsApp للأعمال الذي يمتلك رقم الهاتف المرتبط بالعميل الحالي لواجهة API الخاصة بتطبيق WhatsApp للأعمال، وإلا فلن يتم إرسال الرسالة.

name

مطلوب.

اسم القالب.

language

مطلوب.

يمكن تحديد اللغة التي قد يتم بها عرض القالب. ولا تعمل سياسة اللغة deterministic إلا مع رسائل قوالب الوسائط فقط. ولمزيد من المعلومات، يمكنك الرجوع إلى القسم اللغة.

components

اختياري.

مصفوفة تحتوي على معلمات الرسالة.

كائن المكونات

داخل components، يمكنك إجراء تداخل للكائن parameters. بالإضافة إلى ذلك، يمكنك تعيين type على button.

الاسمالوصف

type

مطلوب.

يمكن وصف النوع component.
القيم:header، body، footer

parameters

اختياري.

مصفوفة تحتوي على محتوى الرسالة.

كائن المعلمة

الاسمالوصف

type

مطلوب.

يمكن وصف النوع parameter.
القيم:text، currency، date_time، image، document، video


تتبع أنواع الوسائط (image وdocument وvideo) التنسيق نفسه المُستخدم في رسائل الوسائط القياسية، ولمزيد من المعلومات، يمكنك الرجوع إلى وثائق الوسائط. ولا يتم حاليًا سوى دعم مستندات بتنسيق PDF بالنسبة لقوالب رسائل الوسائط فقط.


لمزيد من المعلومات حول القيمتين currency وdate_time، يمكنك الرجوع إلى القسم المعلمات القابلة للترجمة. وتستخدم المعلمتان currency وdate_time في رسائل template القيمة fallback_value، بدلًا من القيمة default. وللحصول على مثال، يمكنك الرجوع إلى عينة من الطلب أعلاه.

نوع الزر

داخل الكائن components، يمكنك تعيين type إلى button. هذه هي معلمات الزر:

الاسمالوصف

sub_type

مطلوب.

نوع الزر الذي تم إنشاؤه.
القيم:quick_reply وurl وcopy_code (available from 2.49 and onwards)

index

مطلوب.

فهرس موضع الزر. يمكن أن يتوفر لديك 10 أزرار كحد أقصى باستخدام قيم الفهرس 0-9.

parameters

مطلوب.

المعلمات الخاصة بالزر والتي يتم تعيينها وقت الإنشاء في مدير الأعمال لديك. احرص على تضمين المعلمات التالية:

  • type (مطلوب): يشير إلى نوع المعلمة الخاصة بالزر. القيم المدعومة هي payload وtext وcoupon_code.
  • payload (مطلوب لأزرار quick_reply): حمولة البيانات التي يحددها المطوّر والتي سيتم إرجاعها عند النقر على الزر، بالإضافة إلى نص العرض الموجود على الزر.
  • text (مطلوب لأزرار url): لاحقة يوفرها المطوّر يتم إلحاقها بزر عنوان URL ديناميكي تم إنشاؤه مسبقًا.
  • coupon_code (مطلوب لأزرار copy_code) (متوفر من 2.49 والأحدث): رمز القسيمة الذي يوفره المطوّر والذي يتم نسخه عند النقر على زر "نسخ الرمز".

مثال على نوع button مع sub_type بالقيمة quick_reply:

 {
    "type": "button",
    "sub_type": "quick_reply",
    "index": 0,
    "parameters": 
     [{
    	"type": "payload",
    	"payload": "Yes-Button-Payload"
     }]
 } 

مثال على نوع button مع sub_type بالقيمة copy_code

    
 { 
    "type": "button", 
    "sub_type": "copy_code", 
    "index": 0, 
    "parameters": 
    [{ 
     "type": "coupon_code", 
     "coupon_code": "DISCOUNT20" 
    }] 
 }

كائن Hsm

تم إيقاف استخدام الكائن hsm في الإصدار v2.39 من الواجهة داخل المواقع/المرجع في واتساب للأعمال. يُرجى استخدام الكائن template بدلاً من ذلك.

الاسم الوصف

namespace

مطلوب.

مساحة الاسم المطلوب استخدامها. وبداية من الإصدار v2.2.7، إذا لم تتطابق مساحة الاسم مع element_name، فلن يتم إرسال الرسالة.

element_name

مطلوب.

اسم العنصر الذي يشير إلى القالب المطلوب استخدامه ضمن مساحة الاسم. وبداية من الإصدار v2.2.7، إذا لم يتطابق element_name مع مساحة الاسم، فلن يتم إرسال الرسالة.

language

مطلوب.

يمكن السماح بتوضيح مواصفات أية لغة محددة. ولمزيد من المعلومات، يمكنك الرجوع إلى القسم اللغة.


يُستخدم هذا الحقل للسماح باستخدام خيار fallback، ولكن تم إيقاف استخدامه مع الإصدار v2.27.8.

localizable_params

مطلوب.

يمثل هذا الحقل مصفوفة من القيم المطلوب تطبيقها على المتغيرات الموجودة في القالب. ولمزيد من المعلومات، يمكنك الرجوع إلى القسم المعلمات القابلة للترجمة.

الكائن التفاعلي

The interactive object generally contains 4 main components: header, body, footer, and action. Additionally, some of those components can contain one or more different objects:

  • Inside header, you can nest media objects.
  • Inside action, you can nest section and button objects.
NameDescription

type

string

Required.

The type of interactive message you want to send. Supported values:

  • list: Use it for List Messages.
  • button: Use it for Reply Buttons.
  • product: Use it for Single-Product Messages.
  • product_list: Use it for Multi-Product Messages.
  • catalog_message: Use it for Catalog Messages.
  • flow: Use it for Flows Messages.

header

object

Required for type product_list. Optional for other types.

Header content displayed on top of a message. You cannot set a header if your interactive object is of product type.


The header object contains the following fields:

documentobjectRequired if type is set to document. Contains the media object with the document.

imageobjectRequired if type is set to image. Contains the media object with the image.

videoobjectRequired if type is set to video. Contains the media object with the video.

textstringRequired if type is set to text. Text for the header. Formatting allows emojis, but not markdown. Maximum length: 60 characters.

typestringRequired. The header type you would like to use. Supported values are:

text – for List Messages, Reply Buttons, and Multi-Product Messages.

video – for Reply Buttons.

image – for Reply Buttons.

document – for Reply Buttons.

body

object

Optional for type product. Required for other message types.

An object with the body of the message.


The body object contains the following field:

textstringRequired if body is present. The content of the message. Emojis and markdown are supported. Maximum length: 1024 characters.

footer

object

Optional.

An object with the footer of the message.


The footer object contains the following field:

textstringRequired if footer is present. The footer content. Emojis, markdown, and links are supported. Maximum length: 60 characters.

action

object

Required.

An action object with what you want the user to perform after reading the message. See action object for full information.

كائن الإجراء

NameDescription

button

string

Required for List Messages.

Button content. It cannot be an empty string and must be unique within the message. Emojis are supported, markdown is not. Maximum length: 20 characters.

buttons

object

Required for Reply Button Messages.

A button object. The object can contain the following parameters:

type – The only supported option is reply for Reply Button Messages.

title – Button title. It cannot be an empty string and must be unique within the message. Emojis are supported, markdown is not. Maximum length: 20 characters.

id – Unique identifier for your button. This ID is returned in the webhook when the button is clicked by the user. Maximum length: 256 characters.


لا يمكن أن تتواجد مسافات سابقة أو لاحقة عند تعيين المعرف.

sections

array of objects

Required for List Messages and Multi-Product Messages.

Array of section objects. There is a minimum of 1 and maximum of 10. See section object.

catalog_id

string

Required for Single-Product Messages and Multi-Product Messages.

Unique identifier of the Facebook catalog linked to your WhatsApp Business Account. This ID can be retrieved via Commerce Manager.

product_retailer_id

string

Required for Single-Product Messages and Multi-Product Messages.

Unique identifier of the product in a catalog. Maximum 100 characters for both Single-Product and Multi-Product messages.


To get this ID, go to Commerce Manager, select your Facebook Business account, and you will see a list of shops connected to your account. Click the shop you want to use. On the left-side panel, click Catalog > Items, and find the item you want to mention. The ID for that item is displayed under the item's name.

mode

string

Optional for Flows Messages.

The current mode of the Flow, either draft or published.


Default: published

flow_message_version

string

Required for Flows Messages.

Must be 3.

flow_token

string

Required for Flows Messages.

A token that is generated by the business to serve as an identifier.

flow_id

string

Required for Flows Messages.

Unique identifier of the Flow provided by WhatsApp.

flow_cta

string

Required for Flows Messages.

Text on the CTA button, eg. "Signup".


Maximum length: 20 characters (no emoji).

flow_action

string

Optional for Flows Messages.

navigate or data_exchange. Use navigate to predefine the first screen as part of the message. Use data_exchange for advanced use-cases where the first screen is provided by your endpoint.


Default: navigate

flow_action_payload

object

Optional for Flows Messages.

Required only if flow_action is navigate. The object can contain the following parameters:

screenstringRequired. The id of the first screen of the Flow.

dataobjectOptional. The input data for the first screen of the Flow. Must be a non-empty object.

Section Object

NameDescription

title

string

Required if the message has more than one section.

Title of the section. Maximum length: 24 characters.

rows

array of objects

Required for List Messages.

Contains a list of row objects. Limited to 10 rows across all sections.


Each row object contains the following fields:

titlestringRequired. Maximum length: 24 characters.

IDstringRequired. Maximum length: 200 characters.

descriptionstringOptional. Maximum length: 72 characters.

product_items

array of objects

Required for Multi-Product Messages.

Array of product objects. There is a minimum of 1 product per section and a maximum of 30 products across all sections.


Each product object contains the following field:

product_retailer_idstringRequired for Multi-Product Messages. Unique identifier of the product in a catalog. To get this ID, go to Commerce Manager, select your account and the shop you want to use. Then, click Catalog > Items, and find the item you want to mention. The ID for that item is displayed under the item's name.

أمثلة

الرسائل الصوتية:

POST /v1/messages
{
  "recipient_type": "individual",
  "to": "whatsapp-id",
  "type": "audio",
  "audio": {
      "id": "your-media-id",
  }
}

رسائل المستند باستخدام filename:

POST /v1/messages
{
  "recipient_type": "individual",
  "to": "whatsapp-id",
  "type": "document",
  "document": {
      "id": "your-media-id",
      "filename": "your-document-filename"
  }
}

رسائل المستندات، باستخدام link:

POST /v1/messages
{
  "recipient_type": "individual",
  "to": "whatsapp-id",
  "type": "document",
  "document": {
      "link": "http(s)://the-url"
      "provider": {
          "name" : "provider-name"
      }     
    }
}

رسائل الفيديو باستخدام link:

POST /v1/messages
{
  "recipient_type": "individual",
  "to": "whatsapp-id",
  "type": "video",  
  "video": {
      "link": "http(s)://the-url"
      "provider": {
          "name" : "provider-name"
      }
    }
  }
}

الرسائل النصية:

POST /v1/messages
{
  "recipient_type": "individual",
  "to": "whatsapp-id",
  "type": "text",
  "text": {
      "body": "your-message-content"
  }
}

الرسائل التفاعلية (القوائم):

POST /v1/messages
{
  "recipient_type": "individual",
  "to": "whatsapp-id",
  "type": "interactive",
  "interactive":{
    "type": "list",
    "header": {
      "type": "text",
      "text": "your-header-content-here"
    },
    "body": {
      "text": "your-text-message-content-here"
    },
    "footer": {
      "text": "your-footer-content-here"
    },
    "action": {
      "button": "cta-button-content-here",
      "sections":[
        {
          "title":"your-section-title-content-here",
          "rows": [
            {
              "id":"unique-row-identifier-here",
              "title": "row-title-content-here",
              "description": "row-description-content-here",           
            }
          ]
        },
        {
          "title":"your-section-title-content-here",
          "rows": [
            {
              "id":"unique-row-identifier-here",
              "title": "row-title-content-here",
              "description": "row-description-content-here",           
            }
          ]
        },
        ...
      ]
    }
  }

}

الرسائل التفاعلية (أزرار الرد):

POST /v1/messages
{
  "recipient_type": "individual",
  "to": "whatsapp-id",
  "type": "interactive",
  "interactive": {
    "type": "button",
    "header": { # optional
      "type": "text" | "image" | "video" | "document",
      "text": "your text"
      # OR
      "document": {
        "id": "your-media-id",
        "filename": "some-file-name"
      }
      # OR
      "document": {
        "link": "the-provider-name/protocol://the-url",
        "provider": {
          "name": "provider-name",
        },
        "filename": "some-file-name"
      },
      # OR
      "video": {
        "id": "your-media-id"
      }
      # OR
      "video": {
        "link": "the-provider-name/protocol://the-url",
        "provider": {
          "name": "provider-name"
        }
      }
      # OR
      "image": {
        "id": "your-media-id"
      }
      # OR
      "image": {
        "link": "http(s)://the-url",
        "provider": {
          "name": "provider-name"
        }
      }
    }, # end header
    "body": {
      "text": "your-text-body-content"
    },
    "footer": { # optional
      "text": "your-text-footer-content"
    },
    "action": {
      "buttons": [
        {
          "type": "reply",
          "reply": {
            "id": "unique-postback-id",
            "title": "First Button’s Title" 
          }
        },
        {
          "type": "reply",
          "reply": {
            "id": "unique-postback-id",
            "title": "Second Button’s Title" 
          }
        }
      ] 
    } # end action   
  } # end interactive

}

الرسائل التفاعلية (رسائل المنتج الواحد ورسائل المنتجات المتعددة):

{ 
  "recipient_type": "individual",
  "to" : "{{Recipient-WA-ID}}",
  "type": "interactive",
  "interactive": {
    "type": "product",
    "body": {
      "text": "body text"
    },
    "footer": {
      "text": "footer text"
    },
    "action": {
      "
      
      _id": "catalog-ID",
      "product_retailer_id": "product-ID"
    }
  }
}

الرسائل التفاعلية (رسائل المنتجات المتعددة):

{ 
  "recipient_type": "individual",
  "to" : "whatsapp-id",
  "type": "interactive",
  "interactive": 
    {
    "type": "product_list",
    "Header":{
       "type": "text",
        "text": "text-header-content"
     },
     "body":{
        "text": "text-body-content"
      },
     "footer":{
        "text":"text-footer-content"
     },
     "action":{
        "catalog_id":"catalog-id",
        "sections": [
             {
             "title": "section-title",             
             "product_items": [
                  { "product_retailer_id": "product-SKU-in-catalog" },
                  { "product_retailer_id": "product-SKU-in-catalog" },
                            ...
              ]},
              {
              "title": "the-section-title",
              "product_items": [
                 { "product_retailer_id": "product-SKU-in-catalog" }
                           ...
              ]},
               ...
       ]
     },  
    }
}

الرسائل التفاعلية (رسائل الكتالوج):

{ 
  "recipient_type": "individual",
  "to" : "whatsapp-id",
  "type": "interactive",
  "interactive": 
    {
    "type": "catalog_message",
     "body":{
        "text": "text-body-content"
      },
     "footer":{
        "text":"text-footer-content"
     },
     "action":{
        "name": "catalog_message",
      	"parameters":{ 
      	  "thumbnail_product_retailer_id": "product-SKU-in-catalog"
      	}
     },  
    }
}

الرسائل التفاعلية (التدفقات):

{
  "recipient_type": "individual",
  "to": "{{Recipient-WA-ID}}",
  "type": "interactive",
  "interactive": {
    "type": "flow",
    "header": {
      "type": "text",
      "text": "Flow message header"
    },
    "body": {
      "text": "Flow message body"
    },
    "footer": {
      "text": "Flow message footer"
    },
    "action": {
      "name": "flow",
      "parameters": {
        "flow_message_version": "3",
        "flow_token": "AQAAAAACS5FpgQ_cAAAAAD0QI3s",
        "flow_id": "<FLOW_ID>",
        "flow_cta": "Book!",
        "flow_action": "navigate",
        "flow_action_payload": {
          "screen": "<SCREEN_ID>",
          "data": { # optional
            "user_name": "name",
            "user_age": 25
          }
        }
      }
    }
  }
}

فيما يلي مثال على payload في الاستجابة، ويتم حذف كائنات التعريف وكائنات الأخطاء للاختصار.

{
  "messages": [{ 
    "id": "message-id" 
  }]    
}

في حالة نجاح الطلب، ستتلقى استجابة تحتوي على معرف الرسالة. وإذا قام الطلب بإرجاع القسم errors، فتحقق من الرسالة الأصلية وقم بتصحيح الأخطاء قبل إعادة إرسال الطلب. لمزيد من المعلومات حول الأخطاء، راجع رموز أخطاء عميل الواجهة داخل المواقع/المرجع في واتساب للأعمال ورموز حالة HTTP.

ينطبق على الأنشطة التجارية في البرازيل وكولومبيا وسنغافورة، بدءًا من 12 سبتمبر 2023. ينطبق على كل الأنشطة التجارية بدءًا من 12 أكتوبر 2023.

إذا تم تعليق الطلب لتقييم الجودة، فستحتوي الاستجابة على خاصية message_status مع رسالة تشير إلى أنه لم يتم إرسال الرسالة على الفور وسيتم إرسالها أو تحريرها بعد التحقق من الجودة. لن تتواجد هذه الخاصية إذا تم تعليق الرسالة.

    {
      "messages": [{ 
        "id": "message-id",
        "message_status": "Message has been held because quality assessment is pending",
      }]    
    }
    

التنسيقات في الرسائل النصية

يسمح واتساب ببعض التنسيقات في الرسائل. لتنسيق الرسالة بالكامل أو جزء منها، استخدم رموز التنسيقات هذه:

التنسيقاتالرمزمثال

غامق

نجمة (*)

يُساوي مجموعك الإجمالي *10.50 دولارات*.

مائل

شرطة سفلية (_)

Welcome to _WhatsApp_!

يتوسطه خط

تلدة (~)

This is ~better~ best!

Code

ثلاثة فواصل عليا مائلة (```)

```print 'Hello World';```

الأداء

في هذا السياق، يمثل الأداء عدد الرسائل التي يمكن إرسالها في أي ثانية محددة باستخدام عميل الواجهة داخل المواقع/المرجع في واتساب للأعمال. ويعتمد الحد الأقصى للأداء الذي يمكن تحقيقه على مجموعة مختلفة من العوامل، وأهم تلك العوامل هو خيار إعداد العميل وما إذا تم إرسال الرسالة إلى مستخدم جديد أو مستخدم حالي —يستغرق إعداد جلسات التشفير مدة أطول بقليل عند مراسلة مستخدم جديد.

إعداد العميلالرسائل النصية المدعومة لكل ثانية

قسم واحد

70

أقسام متعددة (32 قسمًا)

250

الأسئلة المتكررة

ملاحظة: يرجى عدم إرسال الرسالة نفسها بشكل متكرر إلى المستلم نفسه الذي يستخدم API واتساب للأعمال.

يمكن أن تكون هناك أسباب متعددة تكمن وراء عدم وصول معدلات الإرسال إلى 100%. تتضمن بعض الحالات الشائعة وصول المستخدمين بشكل متقطع إلى الشبكة أو عدم نشاطهم لفترة من الوقت أو إنشاء تجربة مستخدم عالية الجودة.

الرسائل التي يمكن إرسالها باستخدام واتساب ستتمتع بمعدل إرسال عال جدًا. ومع ذلك، يوجد العديد من الأسباب التي تكمن وراء احتمالية عدم إرسال أية رسالة. ستتمتع بإمكانية الوصول إلى حالة الرسالة بدقة من خلال التحقق من عمليات الاستدعاء لديك. يختلف هذا الأمر عن إرسال الرسائل باستخدام رسالة SMS، فعلى سبيل المثال حيث لا تتمتع بإمكانية الوصول إلى حالة الإرسال النهائية وقد ينتج عن إعادة إرسال الرسالة نتائج مختلفة بالفعل.

قد تظل الرسائل غير مُرسلة نظرًا لأن هاتف المستخدم يكون خارج الخدمة أو البطارية نفدت أو تعرض الهاتف للفقدان وحصل المستخدم على هاتف جديد وقام بتعطيل بطاقة SIM الخاصة به. ومن الممكن ظهور أخطاء في إمكانية عميل النشاط التجاري للاتصال بالشبكة. كما أنه من الممكن عدم إرسال عمليات الاستدعاء (Webhooks). يمكنك التحقق من هذه الحالات من خلال استخدام العقدة health. ويمكنك تشغيل عمليات استدعاء إيصال الخادم لمعرفة أنه تم إرسال الرسالة إلى سحابة خادم واتساب.

كلما وحينما يعيد المستخدم الاتصال بالشبكة، سيتم إرسال كل الرسائل التي أرسلتها إليه. وسيمثل تلقي أكثر من رسالة واحدة تتضمن المحتوى نفسه تجربة سيئة بالنسبة له. ومن المرجح أنه سيحظرك أو يقدم شكوى. ولكن من المرجح أنه سيتم حظرك.

إذا أرسلت رسالة وتلقيت معرف رسالة من واجهة API، فقد اتخذت الإجراءات اللازمة لإرسال هذه الرسالة. ولا تعيد إرسال المحتوى نفسه إلى المستلم نفسه.

إذا كنت تشهد معدلات إرسال منخفضة على مدار فترة زمنية طويلة، فيرجى تقديم تذكرة دعم من خلال الدعم المباشر.

عند إرسال رسالة بمجرد استرداد معرف الرسالة، يعني ذلك أنه تم تخزين طلب الرسالة في قاعدة البيانات. وسيظل عميل واجهة API واتساب للأعمال يحاول إرسال هذه الرسالة حتى يتم الاعتراف بها من قِبل خادم واتساب. ولا تتضمن هذه العملية أي مخطط زمني للإنهاء. ومن ثمّ، سيحاول خادم واتساب إرسال هذه الرسالة إلى هاتف المستخدم. وإذا لم يكن هاتف المستخدم متصلاً، فسيتم تخزين الرسالة لمدة 30 يومًا قبل تجاهلها من قِبل خادم واتساب.

نعم! يسمح لك واتساب بتنسيق النص المحدد داخل الرسائل باستخدام الخط العريض أو الخط المائل أو يتوسطه خط أو الخط الأحادي.

لا تتوفر أية طريقة حاليًا لمعرفة عدد المستخدمين الذين حظروا نشاطك التجاري أو لتحديدهم. ولكن المؤشر الأفضل هو الاستجابة لعمليات استدعاء الحالة وإذا لم تتلق الحالة delivered، فمن ثمّ يكون المستخدم قد حظر نشاطك التجاري أو أن المستخدم لا يتمتع باتصال بالشبكة. ولمزيد من التفاصيل، راجع وثائق Webhook.

إذا كان المستخدم قد حظر نشاطك التجاري، فستظل واجهة API جهات الاتصال تقوم بإرجاع رقم الهاتف هذا باعتباره مستخدم واتساب صالح. ومع ذلك، عندما ترسل الرسالة، لن يتم إرسالها أبدًا. وإذا كانت رسالة مدفوعة، فلن يتم تحصيل أي رسوم منك.

لا، لا يتم ضمان أن يكون الترتيب الذي تم به تلقي الرسائل هو الترتيب نفسه المُستخدم عند إرسال الرسائل. وإذا كانت عملية الترتيب تمثل أمرًا مهمًا بالنسبة لحالة استخدامك، فسيكون النهج المُقترح هو الاستجابة للاستدعاء المعروض الخاص بالرسالة الأولى قبل بدء إرسال الرسالة الثانية.

عند استخدام العقدة messages، تحتاج إلى تعيين العنوان Content-Type إلى application/json في عميل واجهة API واتساب للأعمال من أجل تحليل نص الرسالة بشكل مناسب. كما يتوفر عنوان Authorization الذي يلزم تعيينه ويجب أن يحتوي على رمز وصول غير منتهي الصلاحية. وللحصول على معلومات حول كيفية الحصول على الرمز المميز ووقت انتهاء صلاحيته، راجع وثائق تسجيل الدخول والمصادقة.

قد تتوفر حالات تحتاج فيها إلى المزيد من الوقت لمعالجة أي استعلام وارد من أحد العملاء وقد تتمكّن من تقديم استجابة بعد مرور 24 ساعة. ونوصي بإنشاء قوالب الرسائل من أجل ما يلي:

  • إرسال النتيجة إلى المستخدم، أو
  • مطالبة المستخدم بالرد من أجل تنشيط نافذة خدمة العملاء.

في الحالتين، يرجى التأكد من تقديم المزيد من السياق في قالب الرسالة قدر الإمكان. فعلى سبيل المثال:

  • "مرحبًا {{1}}، بالنسبة للمشكلة التي أبلغت عنها مسبقًا، نأسف أن نخبرك بأن {{2}}. ونعتذر عن أي إزعاج تواجهه."
  • نود أن نخبرك ببعض التحديثات فيما يتعلق بالتذكرة التي قدمتها. ويرجى الاستجابة مجددًا إذا كنت ترغب في متابعة تلقي الدعم."