تم تحديث هذا المستند.
لم تكتمل الترجمة إلى اللغة ‏العربية‏ حتى الآن.
تاريخ تحديث المصدر باللغة الإنجليزية: ‏١ فبراير

الرسائل

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

نقطة النهايةالمصادقة

/PHONE_NUMBER_ID/messages

Developers can authenticate their API calls with the access token generated in the App Dashboard > WhatsApp > API Setup.


Solution Partners must authenticate themselves with an access token with the whatsapp_business_messaging permission.

يتم التعرف على الرسائل بواسطة معرف فريد (WAMID). يمكنك تتبع حالة الرسالة في أحداث Webhooks من خلال معرف WAMID الخاص بها. يمكنك أيضًا تحديد الرسالة الواردة كمقروءة من خلال نقطة نهاية الرسائل. يمكن أن يصل طول معرف WAMID هذا إلى 128 حرفًا كحد أقصى.

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

كائن الرسالة

لإرسال رسالة، يجب أولاً تجميع كائن الرسالة مع المحتوى الذي تريد إرساله. هذه هي المعلمات المستخدمة في كائن message:

NameDescription (Click the arrow in the left column for supported options.)

audio

object

Required when type=audio.

A media object containing audio.

biz_opaque_callback_data

string

Optional.

An arbitrary string, useful for tracking.


For example, you could pass the message template ID in this field to track your customer's journey starting from the first message you send. You could then track the ROI of different message template types to determine the most effective one.


Any app subscribed to the messages webhook field on the WhatsApp Business Account can get this string, as it is included in statuses object within webhook payloads.


Cloud API does not process this field, it just returns it as part of sent/delivered/read message webhooks.


Maximum 512 characters.


Cloud API only.

contacts

object

Required when type=contacts.

A contacts object.

context

object

Required if replying to any message in the conversation.

An object containing the ID of a previous message you are replying to. For example:


{"message_id":"MESSAGE_ID"}


Cloud API only.

document

object

Required when type=document.

A media object containing a document.

hsm

object

Contains an hsm object. This option was deprecated with v2.39 of the On-Premises API. Use the template object instead.


On-Premises API only.

image

object

Required when type=image.

A media object containing an image.

interactive

object

Required when type=interactive.

An interactive object. The components of each interactive object generally follow a consistent pattern: header, body, footer, and action.

location

object

Required when type=location.

A location object.

messaging_product

string

Required

Messaging service used for the request. Use "whatsapp".


Cloud API only.

preview_url

boolean

Required if type=text.

Allows for URL previews in text messages — See the Sending URLs in Text Messages. This field is optional if not including a URL in your message. Values: false (default), true.


On-Premises API only. Cloud API users can use the same functionality with the preview_url field inside a text object.

recipient_type

string

Optional.

Currently, you can only send messages to individuals. Set this as individual.


Default: individual

status

string

A message's status. You can use this field to mark a message as read. See the following guides for information:


sticker

object

Required when type=sticker.

A media object containing a sticker.


Cloud API: Static and animated third-party outbound stickers are supported in addition to all types of inbound stickers. A static sticker needs to be 512x512 pixels and cannot exceed 100 KB. An animated sticker must be 512x512 pixels and cannot exceed 500 KB.


On-Premises API: Only static third-party outbound stickers are supported in addition to all types of inbound stickers. A static sticker needs to be 512x512 pixels and cannot exceed 100 KB. Animated stickers are not supported.

template

object

Required when type=template.

A template object.

text

object

Required for text messages.

A text object.

to

string

Required.

WhatsApp ID or phone number of the customer you want to send a message to. See Phone Number Formats.


If needed, On-Premises API users can get this number by calling the contacts endpoint.

type

string

Optional.

The type of message you want to send. If omitted, defaults to text.

يتم تضمين الكائنات التالية داخل كائن الرسالة:

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

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.

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

الاسمالوصف

action

object (كائن)

مطلوب.

الإجراء الذي تريد من المستخدم القيام به بعد قراءة الرسالة.

body

object (كائن)

اختياري للنوعproduct. مطلوب لأنواع الرسائل الأخرى.

كائن مع نص الرسالة.


يحتوي الكائن body على الحقل التالي:

text string (سلسلة) - مطلوب إذا كان النص موجودًا. محتوى الرسالة. ويتم دعم الرموز التعبيرية وmarkdown. الحد الأقصى للطول: 1024 حرفًا.

footer

object (كائن)

اختياري. كائن يحتوي على تذييل الرسالة.


يحتوي كائن footer على الحقل التالي:

textstring (سلسلة) - مطلوب إذا كان التذييل موجودًا. محتوى التذييل. يتم دعم الرموز التعبيرية وmarkdown والروابط. الحد الأقصى للطول: 60 حرفًا.

header

object (كائن)

مطلوب للنوع product_list. اختياري لأنواع أخرى.

محتوى العنوان المعروض أعلى رسالة. لا يمكنك تعيين العنوان إذا كان الكائن التفاعلي من النوع product. يمكنك الاطلاع على كائن header لمزيد من المعلومات.

type

object (كائن)

مطلوب.

يمثل نوع الرسالة التفاعلية التي تريد إرسالها. علمًا بأن القيم المدعومة هي:


  • button: يستخدم مع أزرار الرد.
  • catalog_message: يستخدم مع رسائل الكتالوج.
  • list: يستخدم مع رسائل القوائم.
  • product: يستخدم مع رسائل المنتج الواحد.
  • product_list: يستخدم مع رسائل المنتجات المتعددة.
  • flow: يستخدم مع رسائل التدفقات.

يتم تضمين الكائنات التالية داخل الكائن interactive:

كائن الإجراء

الاسمالوصف

button

string (سلسلة)

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

يمثل محتوى الزر. ولا يمكن أن يمثل سلسلة فارغة ويجب أن يكون فريدًا ضمن الرسالة. يتم دعم الرموز التعبيرية وليس markdown.


الحد الأقصى للطول: 20 حرفًا.

buttons

array of objects (مصفوفة من الكائنات)

مطلوب لأزرار الرد.

يمكن أن يحتوي كائن الزر على المعلمات التالية:


  • type: النوع المدعوم فقط هو reply (لزر الرد)
  • title: عنوان الزر. ولا يمكن أن يمثل سلسلة فارغة ويجب أن يكون فريدًا ضمن الرسالة. يتم دعم الرموز التعبيرية وليس markdown. الحد الأقصى للطول: 20 حرفًا.
  • id: يمثل المعرف الفريد للزر لديك. ويتم إرجاع هذا المعرف في حدث webhook عندما ينقر المستخدم على الزر. الحد الأقصى للطول: 256 حرفًا.

يمكنك إنشاء ما يصل إلى 3 أزرار. لا يمكن أن يكون لديك مسافات بادئة أو زائدة عند تعيين المعرف.

catalog_id

string (سلسلة)

مطلوب في رسائل المنتج الواحد ورسائل المنتجات المتعددة.

المعرف الفريد لكتالوج فيسبوك المرتبط بحساب واتساب للأعمال. يمكن استرداد هذا المعرف عبر مدير المعاملات التجارية في Meta.

product_retailer_id

string (سلسلة)

مطلوب في رسائل المنتج الواحد ورسائل المنتجات المتعددة.

المعرف الفريد للمنتج في الكتالوج.


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

sections

array of objects (مصفوفة من الكائنات)

مطلوب في رسائل قوائم المعروضات ورسائل المنتجات المتعددة.

يمثل مصفوفة من كائنات section. الحد الأدنى 1 والحد الأقصى 10. يمكنك الاطلاع على الكائن section.

mode

string (سلسلة)

اختياري لرسائل التدفقات.

الوضع الحالي للدفق، إما draft أو published.


القيمة الافتراضية: published

flow_message_version

string (سلسلة)

مطلوب لرسائل التدفقات.

يجب أن يكون 3.

flow_token

string (سلسلة)

مطلوب لرسائل التدفقات.

رمز يتم إنشاؤه بواسطة النشاط التجاري ليكون بمثابة معرف.

flow_id

string (سلسلة)

مطلوب لرسائل التدفقات.

المعرف الفريد للدفق والذي يوفره واتساب.

flow_cta

string (سلسلة)

مطلوب لرسائل التدفقات.

النص الموجود على زر الدعوة لاتخاذ إجراء، على سبيل المثال. "تسجيل".


الحد الأقصى للطول: 20 حرفًا (بدون رموز تعبيرية).

flow_action

string (سلسلة)

اختياري لرسائل التدفقات.

navigate أو data_exchange. استخدم navigate لتحديد الشاشة الأولى مسبقًا كجزء من الرسالة. استخدم data_exchange لحالات الاستخدام المتقدمة حيث يتم توفير الشاشة الأولى بواسطة نقطة النهاية المتوفرة لديك.


القيمة الافتراضية: navigate

flow_action_payload

object (كائن)

اختياري لرسائل التدفقات.

مطلوب فقط إذا كان flow_action بالقيمة navigate. يمكن أن يحتوي الكائن على المعلمات التالية:

screenstring - مطلوب.id الخاص بالشاشة الأولى من الدفق.

dataobject (كائن) - اختياري. بيانات الإدخال للشاشة الأولى للدفق. يجب أن يكون كائنًا غير فارغ.

كائن العنوان

الاسمالوصف

document

object (كائن)

مطلوب إذا تم تعيين type على document.

يحتوي على كائن الوسائط لهذا المستند.

image

object (كائن)

مطلوب إذا تم تعيين type على image.

يحتوي على كائن الوسائط لهذه الصورة.

text

string (سلسلة)

مطلوب إذا تم تعيين type على text.

يمثل نص العنوان. ويسمح التنسيق بالرموز التعبيرية، وليس markdown.


الحد الأقصى للطول: 60 حرفًا.

type

string (سلسلة)

مطلوب.

نوع العنوان الذي تريد استخدامه. علمًا بأن القيم المدعومة هي:


  • text: يستخدم مع رسائل قوائم المعروضات وأزرار الرد ورسائل المنتجات المتعددة.
  • video: يتم استخدامها في أزرار الرد.
  • image: يتم استخدامها في أزرار الرد.
  • document: يستخدم مع أزرار الرد.

video

object (كائن)

مطلوب إذا تم تعيين type على video.

يحتوي على كائن الوسائط لهذا الفيديو.

كائن القسم

الاسمالوصف

product_items

array of objects (مصفوفة من الكائنات)

مطلوب للرسائل المرتبطة بعدة منتجات.

مصفوفة من كائنات product. يوجد منتج واحد على الأقل لكل قسم و30 منتجًا كحد أقصى في جميع الأقسام.


يحتوي كل كائن product على الحقل التالي:


  • product_retailer_idstring (سلسلة) - مطلوب للرسائل متعددة المنتجات. المعرف الفريد للمنتج في الكتالوج. للحصول على هذا المعرف، انتقل إلى مدير المعاملات التجارية في Meta، وحدّد حسابك والمتجر الذي تريد استخدامه. بعد ذلك، انقر على الكتالوج > العناصر، واعثر على العنصر الذي تريد ذكره. يتم عرض معرف ذلك العنصر أسفل اسم العنصر.

rows

array of objects (مصفوفة من الكائنات)

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

يحتوي على قائمة من الصفوف. يمكن أن يكون لديك إجمالي 10 صفوف على مستوى الأقسام الخاصة بك.


يجب أن يكون لكل صف عنوانًا (الحد الأقصى للطول: 24 حرفًا) ومعرفًا (الحد الأقصى للطول: 200 حرفًا). يمكنك إضافة وصف (الحد الأقصى للطول: 72 حرفًا)، ولكنه اختياري.


مثال:

"rows": [
  {
   "id":"unique-row-identifier-here",
   "title": "row-title-content-here",
   "description": "row-description-content-here",           
   }
]

title

string (سلسلة)

مطلوب إذا كانت الرسالة تحتوي على أكثر من قسم.

عنوان القسم.


الحد الأقصى للطول: 24 حرفًا.

كائن الموقع

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.

كائن الوسائط

راجع احصل على معرف الوسائط للحصول على معلومات حول كيفية الحصول على معرف كائن الوسائط. للحصول على معلومات حول أنواع الوسائط المدعومة في API السحابة، راجع أنواع الوسائط المدعومة.

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.

كائن القالب

تم تغيير التسعير المستند إلى المحادثة. راجع التسعير لمعرفة كيفية عمل نموذج التسعير الجديد المستند إلى المحادثة.

بالإضافة إلى ذلك، تم تغيير رؤية metric_types اعتبارًا من 1 يوليو 2023. يرجى الرجوع إلى جدول تحليلات المحادثة لمزيد من التفاصيل.

NameDescription

name

Required.

Name of the template.

language

object

Required.

Contains a language object. Specifies the language the template may be rendered in.


The language object can contain the following fields:

policystringRequired. The language policy the message should follow. The only supported option is deterministic. See Language Policy Options.

codestringRequired. The code of the language or locale to use. Accepts both language and language_locale formats (e.g., en and en_US). For all codes, see Supported Languages.

components

array of objects

Optional.

Array of components objects containing the parameters of the message.

namespace

Optional. Only used for On-Premises API.

Namespace of the template.

يتم تضمين الكائنات التالية داخل كائن template:

كائن معلمة الزر

الاسمالوصف (انقر على السهم في العمود الأيمن للتعرف على الخيارات المدعومة.)

type

string (سلسلة)

مطلوب.

يشير إلى نوع المعلمة في الزر.

الخيارات المدعومة

  • "payload"
  • "text"

payload

مطلوب لأزرار quick_reply

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


راجع الاستدعاء الوارد من النقر على زر الرد السريع على سبيل المثال.

text

مطلوب لأزرار عنوان URL.

اللاحقة التي يوفرها المطوّر والتي يتم إلحاقها بعنوان URL للبادئة المحددة مسبقًا في القالب.

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

NameDescription (Click the arrow in the left column for supported options.)

type

string

Required.

Describes the component type.


Example of a components object with an array of parameters object nested inside:

 "components": [{
   "type": "body",
   "parameters": [{
                "type": "text",
                "text": "name"
            },
            {
            "type": "text",
            "text": "Hi there"
            }]
      }] 

Supported Options

  • header
  • body
  • button

For text-based templates, we only support the type=body.

sub_type

string

Required when type=button. Not used for the other types.

Type of button to create.

Supported Options

  • quick_reply: Refers to a previously created quick reply button that allows for the customer to return a predefined message.
  • url: Refers to a previously created button that allows the customer to visit the URL generated by appending the text parameter to the predefined prefix URL in the template.
  • catalog: Refers to a previously created catalog button that allows for the customer to return a full product catalog.

parameters

array of objects

Required when type=button.

Array of parameter objects with the content of the message.

For components of type=button, see the button parameter object.

index

Required when type=button. Not used for the other types.

Position index of the button. You can have up to 10 buttons using index values of 0 to 9.

كائن العملة

الاسمالوصف

fallback_value

مطلوب.

النص الافتراضي في حالة فشل الترجمة.

code

مطلوب.

رمز العملة كما هو محدد في ISO 4217.

amount_1000

مطلوب.

المبلغ مضروبًا في 1000.

كائن Date_Time

الاسمالوصف

fallback_value

مطلوب.

النص الافتراضي. بالنسبة إلى API السحابة، نستخدم دائمًا القيمة الاحتياطية، ولا نحاول الترجمة باستخدام الحقول الاختيارية الأخرى.

كائن المعلمة

الاسمالوصف

type

string (سلسلة)

مطلوب.

يصف نوع المعلمة. علمًا بأن القيم المدعومة هي:


  • currency
  • date_time
  • document
  • image
  • text
  • video

بالنسبة للقوالب المستندة إلى النص، فإن أنواع المعلمات الوحيدة المدعومة هي currency وdate_time وtext.

text

string (سلسلة)

مطلوب عند وجود type=text.

نص الرسالة. يختلف عدد الأحرف المسموح به بناءً على نوع المكون المضمن التالي.


بالنسبة لنوع المكون header:

  • 60 حرفًا

بالنسبة لنوع المكون body:

  • 1024 حرفًا إذا تم تضمين أنواع مكونات الأخرى
  • 32768 حرفًا إذا كان body هو نوع المكون الوحيد المتضمن

currency

object (كائن)

مطلوب عند وجود type=currency.

كائن currency.

date_time

object (كائن)

مطلوب عند وجود type=date_time.

كائن date_time.

image

object (كائن)

مطلوب عند وجود type=image.

كائن media من النوع image. الشروح التوضيحية غير مدعومة عند استخدامها في قالب الوسائط.

document

object (كائن)

مطلوب عند وجود type=document.

كائن media من النوع document. لا يتم دعم سوى مستندات بتنسيق PDF بالنسبة لقوالب الرسائل المستندة إلى الوسائط. الشروح التوضيحية غير مدعومة عند استخدامها في قالب الوسائط.

video

object (كائن)

مطلوب عند وجود type=video.

كائن media من النوع video. الشروح التوضيحية غير مدعومة عند استخدامها في قالب الوسائط.

كائن النص

الاسمالوصف

body

string (سلسلة)

مطلوب للرسائل النصية.

نص الرسالة النصية التي يمكن أن تحتوي على عناوين URL التي تبدأ بـ http:// أو https:// والتنسيق. راجع خيارات التنسيق المتاحة هنا.


إذا قمت بتضمين عناوين URL في النص وتريد تضمين مربع معاينة في الرسائل النصية (preview_url: true)، فتأكد من أن عنوان URL يبدأ بـ http:// أو https://https:// يُفضّل استخدام عناوين URL. يجب تضمين اسم مضيف، حيث لن تتم مطابقة عناوين IP.


الحد الأقصى للطول: 4096 حرفًا

preview_url

boolean (قيمة منطقية)

اختياري. API السحابة فقط.

قم بالتعيين على true ليحاول تطبيقي واتساب مسنجر وواتساب للأعمال تقديم معاينة رابط لأي عنوان URL في السلسلة النصية body. يجب أن تبدأ عناوين URL بـ http:// أو https://. إذا كانت هناك عدة عناوين URL في السلسلة النصية body، فسيتم عرض عنوان URL الأول فقط.


إذا تم حذف preview_url، أو إذا لم تتمكن من استرداد المعاينة، فسيتم عرض رابط قابل للنقر عليه بدلاً من ذلك.


بالنسبة لمستخدمي API داخل المواقع، استخدم preview_url في حمولة الرسائل ذات المستوى الأعلى بدلاً من ذلك. راجع المعلمات.

كائن التفاعل

الاسمالوصف

message_id

string (سلسلة)

مطلوب.

معرف رسالة واتساب (wamid) للرسالة التي يجب أن يظهر عليها التفاعل. لن يتم إرسال التفاعل إذا:


  • كانت الرسالة أقدم من 30 يومًا
  • كانت الرسالة عبارة عن رسالة تفاعل
  • تم حذف الرسالة

إذا كان المعرف تابعًا لرسالة تم حذفها، فلن يتم تسليم الرسالة.

emoji

string (سلسلة)

مطلوب.

الرمز التعبيري المطلوب عرضه في الرسالة


  • يتم دعم جميع الرموز التعبيرية التي تدعمها أجهزة Android وiOS.
  • يتم دعم الرموز التعبيرية المعروضة.
  • في حالة استخدام قيم unicode للرموز التعبيرية، فيجب أن تكون القيم بتشفير Java أو JavaScript-escape.
  • يمكن إرسال رمز تعبيري واحد فقط في رسالة التفاعل
  • استخدم سلسلة فارغة لإزالة الرموز التعبيرية التي تم إرسالها مسبقًا.

نظرة عامة

الدلائل

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

أمثلة

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

curl -X  POST \
'https://graph.facebook.com/v19.0/FROM_PHONE_NUMBER_ID/messages' \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '
    {
      "messaging_product": "whatsapp",
      "recipient_type": "individual",
      "to": "PHONE_NUMBER",
      "type": "text",
      "text": { // the text object
        "preview_url": false,
        "body": "MESSAGE_CONTENT"
        }
    }'

رسائل التفاعلات

curl -X  POST \
 'https://graph.facebook.com/v19.0/FROM_PHONE_NUMBER_ID/messages' \
 -H 'Authorization: Bearer ACCESS_TOKEN' \
 -H 'Content-Type: application/json' \
 -d '{
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "PHONE_NUMBER",
  "type": "reaction",
  "reaction": {
    "message_id": "wamid.HBgLM...",
    "emoji": "\uD83D\uDE00"
  }
}'

رسائل الوسائط

curl -X  POST \
 'https://graph.facebook.com/v19.0/FROM-PHONE-NUMBER-ID/messages' \
 -H 'Authorization: Bearer ACCESS_TOKEN' \
 -H 'Content-Type: application/json' \
 -d '{
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "PHONE-NUMBER",
  "type": "image",
  "image": {
    "id" : "MEDIA-OBJECT-ID"
  }
}'

رسائل المواقع

curl -X  POST \
 'https://graph.facebook.com/v19.0/FROM_PHONE_NUMBER_ID/messages' \
 -H 'Authorization: ACCESS_TOKEN' \
 -H 'Content-Type: application/json' \
 -d '{
  "messaging_product": "whatsapp",
  "to": "PHONE_NUMBER",
  "type": "location",
  "location": {
    "longitude": LONG_NUMBER,
    "latitude": LAT_NUMBER,
    "name": LOCATION_NAME,
    "address": LOCATION_ADDRESS
  }
}'

رسائل جهات الاتصال

curl -X  POST \
 'https://graph.facebook.com/v19.0/FROM_PHONE_NUMBER_ID/messages' \
 -H 'Authorization: ACCESS_TOKEN' \
 -H 'Content-Type: application/json' \
 -d '{
  "messaging_product": "whatsapp",
  "to": "PHONE_NUMBER",
  "type": "contacts",
  "contacts": [{
      "addresses": [{
          "street": "STREET",
          "city": "CITY",
          "state": "STATE",
          "zip": "ZIP",
          "country": "COUNTRY",
          "country_code": "COUNTRY_CODE",
          "type": "HOME"
        },
        {
          "street": "STREET",
          "city": "CITY",
          "state": "STATE",
          "zip": "ZIP",
          "country": "COUNTRY",
          "country_code": "COUNTRY_CODE",
          "type": "WORK"
        }],
      "birthday": "YEAR_MONTH_DAY",
      "emails": [{
          "email": "EMAIL",
          "type": "WORK"
        },
        {
          "email": "EMAIL",
          "type": "HOME"
        }],
      "name": {
        "formatted_name": "NAME",
        "first_name": "FIRST_NAME",
        "last_name": "LAST_NAME",
        "middle_name": "MIDDLE_NAME",
        "suffix": "SUFFIX",
        "prefix": "PREFIX"
      },
      "org": {
        "company": "COMPANY",
        "department": "DEPARTMENT",
        "title": "TITLE"
      },
      "phones": [{
          "phone": "PHONE_NUMBER",
          "type": "HOME"
        },
        {
          "phone": "PHONE_NUMBER",
          "type": "WORK",
          "wa_id": "PHONE_OR_WA_ID"
        }],
      "urls": [{
          "url": "URL",
          "type": "WORK"
        },
        {
          "url": "URL",
          "type": "HOME"
        }]
    }]
}'

الرسائل التفاعلية

رسائل المنتج الواحد

curl -X  POST \
 'https://graph.facebook.com/v19.0/FROM_PHONE_NUMBER/messages' \
 -H 'Authorization: Bearer ACCESS_TOKEN' \
 -H 'Content-Type: application/json' \
 -d '{
   "messaging_product": "whatsapp",
   "recipient_type": "individual",
   "to": "PHONE_NUMBER",
   "type": "interactive",
   "interactive": {
     "type": "product",
     "body": {
       "text": "optional body text"
     },
     "footer": {
       "text": "optional footer text"
     },
     "action": {
       "catalog_id": "CATALOG_ID",
       "product_retailer_id": "ID_TEST_ITEM_1"
     }
   }
 }'

رسائل المنتجات المتعددة

curl -X  POST \
 'https://graph.facebook.com/v19.0/FROM_PHONE_NUMBER/messages' \
 -H 'Authorization: Bearer ACCESS_TOKEN' \
 -H 'Content-Type: application/json' \
 -d '{
 "messaging_product": "whatsapp",
   "recipient_type": "individual",
   "to": "PHONE_NUMBER",
   "type": "interactive",
   "interactive": {
     "type": "product_list",
     "header":{
       "type": "text",
       "text": "header-content"
     },
     "body": {
       "text": "body-content"
     },
     "footer": {
       "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": "section-title",
           "product_items": [
             { "product_retailer_id": "product-SKU-in-catalog" },
             { "product_retailer_id": "product-SKU-in-catalog" },
             ...
           ]
         }
       ]
     }
   }
 }

رسائل الكتالوج

curl -X  POST \
 'https://graph.facebook.com/v19.0/FROM_PHONE_NUMBER/messages' \
 -H 'Authorization: Bearer ACCESS_TOKEN' \
 -H 'Content-Type: application/json' \
 -d '{
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "PHONE_NUMBER",
  "type": "interactive",
  "interactive" : {
    "type" : "catalog_message",
    "body" : {
      "text": "Thanks for your order! Tell us what address you’d like this order delivered to."
    },
    "action": {
      "name": "catalog_message",
      "parameters": { 
        "thumbnail_product_retailer_id": "<Product-retailer-id>"
      }
    }
  }
}'

رسائل التدفقات

curl -X  POST \
 'https://graph.facebook.com/v19.0/FROM_PHONE_NUMBER/messages' \
 -H 'Authorization: Bearer ACCESS_TOKEN' \
 -H 'Content-Type: application/json' \
 -d '{
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "PHONE_NUMBER",
  "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": {
            "user_name": "name",
            "user_age": 25
          }
        }
      }
    }
  }
}'
  

رسائل القوائم

curl -X  POST \
 'https://graph.facebook.com/v19.0/FROM_PHONE_NUMBER_ID/messages' \
 -H 'Authorization: Bearer ACCESS_TOKEN' \
 -H 'Content-Type: application/json' \
 -d '{
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "PHONE_NUMBER",
  "type": "interactive",
  "interactive": {
    "type": "list",
    "header": {
      "type": "text",
      "text": "HEADER_TEXT"
    },
    "body": {
      "text": "BODY_TEXT"
    },
    "footer": {
      "text": "FOOTER_TEXT"
    },
    "action": {
      "button": "BUTTON_TEXT",
      "sections": [
        {
          "title": "SECTION_1_TITLE",
          "rows": [
            {
              "id": "SECTION_1_ROW_1_ID",
              "title": "SECTION_1_ROW_1_TITLE",
              "description": "SECTION_1_ROW_1_DESCRIPTION"
            },
            {
              "id": "SECTION_1_ROW_2_ID",
              "title": "SECTION_1_ROW_2_TITLE",
              "description": "SECTION_1_ROW_2_DESCRIPTION"
            }
          ]
        },
        {
          "title": "SECTION_2_TITLE",
          "rows": [
            {
              "id": "SECTION_2_ROW_1_ID",
              "title": "SECTION_2_ROW_1_TITLE",
              "description": "SECTION_2_ROW_1_DESCRIPTION"
            },
            {
              "id": "SECTION_2_ROW_2_ID",
              "title": "SECTION_2_ROW_2_TITLE",
              "description": "SECTION_2_ROW_2_DESCRIPTION"
            }
          ]
        }
      ]
    }
  }
}'

زر الرد

curl -X  POST \
 'https://graph.facebook.com/v19.0/FROM_PHONE_NUMBER_ID/messages' \
 -H 'Authorization: Bearer ACCESS_TOKEN' \
 -H 'Content-Type: application/json' \
 -d '{
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "PHONE_NUMBER",
  "type": "interactive",
  "interactive": {
    "type": "button",
    "body": {
      "text": "BUTTON_TEXT"
    },
    "action": {
      "buttons": [
        {
          "type": "reply",
          "reply": {
            "id": "UNIQUE_BUTTON_ID_1",
            "title": "BUTTON_TITLE_1"
          }
        },
        {
          "type": "reply",
          "reply": {
            "id": "UNIQUE_BUTTON_ID_2",
            "title": "BUTTON_TITLE_2"
          }
        }
      ]
    }
  }
}'

رسائل القالب

تم تغيير التسعير المستند إلى المحادثة. راجع التسعير لمعرفة كيفية عمل نموذج التسعير الجديد المستند إلى المحادثة.

بالإضافة إلى ذلك، تم تغيير رؤية metric_types اعتبارًا من 1 يوليو 2023. يرجى الرجوع إلى جدول تحليلات المحادثة لمزيد من التفاصيل.

curl -X  POST \
 'https://graph.facebook.com/v19.0/FROM_PHONE_NUMBER_ID/messages' \
 -H 'Authorization: Bearer ACCESS_TOKEN' \
 -H 'Content-Type: application/json' \
 -d '{
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "PHONE_NUMBER",
  "type": "template",
  "template": {
    "name": "TEMPLATE_NAME",
    "language": {
      "code": "LANGUAGE_AND_LOCALE_CODE"
    },
    "components": [
      {
        "type": "header",
        "parameters": [
          {
            "type": "image",
            "image": {
              "link": "http(s)://URL"
            }
          }
        ]
      },
      {
        "type": "body",
        "parameters": [
          {
            "type": "text",
            "text": "TEXT_STRING"
          },
          {
            "type": "currency",
            "currency": {
              "fallback_value": "VALUE",
              "code": "USD",
              "amount_1000": NUMBER
            }
          },
          {
            "type": "date_time",
            "date_time": {
              "fallback_value": "MONTH DAY, YEAR"
            }
          }
        ]
      },
      {
        "type": "button",
        "sub_type": "quick_reply",
        "index": "0",
        "parameters": [
          {
            "type": "payload",
            "payload": "PAYLOAD"
          }
        ]
      },
      {
        "type": "button",
        "sub_type": "quick_reply",
        "index": "1",
        "parameters": [
          {
            "type": "payload",
            "payload": "PAYLOAD"
          }
        ]
      }
    ]
  }
}'

الرد على الرسالة

curl -X POST \
 'https://graph.facebook.com/v19.0/FROM_PHONE_NUMBER/messages' \
 -H 'Authorization: Bearer ACCESS_TOKEN' \
 -H 'Content-Type: application/json' \
 -d '{
  "messaging_product": "whatsapp",
  "context": {
     "message_id": "MESSAGE_ID"
  },
  "to": "PHONE_NUMBER",
  "type": "text",
  "text": {
    "preview_url": false,
    "body": "your-text-message-content"
  }
}’

الاستجابة الناجحة

    {
      "messaging_product": "whatsapp",
      "contacts": [
        {
          "input": "16505555555",
          "wa_id": "16505555555"
        }
      ],
      "messages": [
        {
          "id": "wamid.HBgLMTY1MDUwNzY1MjAVAgARGBI5QTNDQTVCM0Q0Q0Q2RTY3RTcA"
        }
      ]
    }
    

Applies to businesses in Brazil, Colombia, and Singapore, starting September 12, 2023. Applies to all businesses starting October 12, 2023.

Messages will have one of the following statuses which will be returned in each of the messages objects

  • "message_status":"accepted" : means the message was sent to the intended recipient
  • "message_status":"held_for_quality_assessment": means the message send was delayed until quality can be validated and it will either be sent or dropped at this point

      {
      "messaging_product": "whatsapp",
      "contacts": [
        {
          "input": "16505555555",
          "wa_id": "16505555555"
        }
      ],
      "messages": [
        {
          "id": "wamid.HBgLMTY1MDUwNzY1MjAVAgARGBI5QTNDQTVCM0Q0Q0Q2RTY3RTcA",
          "message_status": "accepted",
        }
      ]
    }