تنسيقات الرد التلقائي على الويب في "المهام مع مساعد Google" (Dialogflow)
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
يوضِّح هذا المستند تنسيق الرد التلقائي على الويب للتواصل بين "المهام مع مساعد Google"
وخدمة تنفيذ الطلبات التي تُحدِّد واجهة مستخدم محادثات مخصَّصة.
من المهم فهم كيفية تواصل "المهام مع مساعد Google" وتنفيذك من خلال تنسيقات الردّ التلقائي على الويب في "المهام مع مساعد Google":
للمشاركة في محادثات باستخدام "المهام مع مساعد Google"، يتم تنفيذ ردّ تلقائي على الويب يمكنه الردّ على طلبات HTTP من "المهام مع مساعد Google".
عندما يستدعي المستخدمون الإجراء الخاص بك، تتلقّى عملية تنفيذ الإجراء HTTP POST مع حمولة بيانات JSON تصف طلب المستخدم.
في المقابل، يكون التنفيذ مسؤولاً عن قراءة المعلَمات من حمولة الطلب وإنشاء استجابة بتنسيق JSON مناسب وإرسال ردّ إلى "مساعد Google" يتضمّن هذا الردّ.
أنواع الطلبات
يلخّص هذا الجدول أنواع الطلبات التي قد يتلقّاها الردّ التلقائي على الويب من "مساعد Google":
Type
الوصف
أمثلة على JSON
طلبات الاستدعاء
العبارات التي يألفها المستخدم والتي تبدأ المحادثة مع الطلب أو تؤدّي إلى تنفيذ إجراءات برابط لصفحة في التطبيق (على سبيل المثال، "التحدّث إلى طاهٍ شخصي للعثور على وصفات طعام العشاء")
في حال استخدام Dialogflow، تتوافق هذه الطلبات مع الأغراض
المحدّدة في قسم اقتراحات ضمن إعدادات دمج مساعد Google.
في حال استخدام حزمة تطوير البرامج (SDK) للإجراءات، تتوافق هذه الطلبات مع الأغراض المحدّدة في حزمة الإجراءات.
العبارات التي قالها المستخدمون في الجلسة نفسها بعد بدء المحادثة مع
قسم التنفيذ. في تنسيق الرد التلقائي على الويب للمحادثة، هذه هي
الردود النصية الأولية من المستخدم والتي تتوافق مع نوايا actions.intent.TEXT
التي طلبها تنفيذك في الدور السابق.
الطلبات التي أرسلها "مساعد Google" إلى عملية التنفيذ عندما يطلب الردّ التلقائي على الويب
نيّة مساعد
في المرحلة السابقة من المحادثة للتعامل مع أجزاء
من المحادثة (على سبيل المثال، actions.intent.OPTION
وactions.intent.PERMISSION).
في سيناريو تفاعل "المهام مع مساعد Google" النموذجي، ينطق المستخدمون عبارة لاستدعاء إجراء. لتقديم رد، تعثر ميزة "المهام مع مساعد Google" على التنفيذ الذي يطابق
الإجراء الذي استدعاه المستخدم ويرسل الطلب إلى هناك.
بعد أن تثبت خدمة Actions on Google أنّ عملية تنفيذ طلبك مطابقة مناسبة لاستدعاء المستخدم، يتم بدء جلسة محادثة عن طريق إرسال طلب HTTP يتضمّن حمولة JSON بمعلومات طلب المستخدم إلى نقطة نهاية التنفيذ. يحلل التنفيذ الذي تقوم به الطلب ويعرض ردًا
يحتوي على حمولة JSON. ثم تحوّل "المهام مع مساعد Google" الحمولة إلى كلام وإخراج وسائط متعددة معروض للمستخدمين.
الشكل 1. يستدعي "المهام مع مساعد Google" عملية التنفيذ من خلال
حزمة تطوير البرامج (SDK) للإجراءات.
لمزيد من المعلومات عن تنسيق حمولة JSON عندما تستدعي "المهام مع مساعد Google" عملية التنفيذ من خلال حزمة تطوير البرامج "للمهام"، يُرجى الاطّلاع على تنسيق الرد التلقائي على الويب للمحادثة.
الطلبات والردود في Dialogflow
عند إنشاء "المهام"، يمكنك استخدام Dialogflow لتبسيط
مهمة إنشاء واجهات محادثات. في هذا السيناريو، يعمل Dialogflow كوكيل
بين "المهام مع مساعد Google" وتنفيذك. وبدلاً من إرسال طلب HTTP/JSON مباشرةً إلى نقطة نهاية التنفيذ، يرسله "المهام مع مساعد Google" إلى Dialogflow.
يدمج Dialogflow حمولة بيانات JSON المضمّنة في الطلب الأصلي بتنسيق
الرد التلقائي على الويب في Dialogflow، ويُعيد توجيه الطلب الناتج إلى تنفيذ Dialogflow.
وفي المقابل، عندما يرسل التنفيذ ردًا إلى Dialogflow، يجب أن تتوافق حمولة JSON
للاستجابة مع تنسيق الرد التلقائي على الويب في Dialogflow. يحلّل التنفيذ المعلَمات من طلب Dialogflow JSON وينشئ ردًا بتنسيق الرد التلقائي على الويب في Dialogflow. يحوّل Dialogflow الرد من تنفيذك إلى رسالة رد يفهمها
مساعد Google.
الشكل 2. يستدعي "المهام مع مساعد Google" عملية تنفيذ طلبك من خلال
Dialogflow.
تاريخ التعديل الأخير: 2025-07-28 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-28 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eActions on Google communicates with your fulfillment service through webhooks, sending JSON payloads that describe user requests.\u003c/p\u003e\n"],["\u003cp\u003eYour fulfillment service needs to process these requests, generate appropriate JSON responses, and send them back to the Assistant.\u003c/p\u003e\n"],["\u003cp\u003eThere are two main webhook formats: Dialogflow webhook format and Conversation webhook format, depending on whether you use Dialogflow or Actions SDK.\u003c/p\u003e\n"],["\u003cp\u003eWebhooks can handle different request types like invocation requests, conversation requests, and helper results, each with specific JSON structures.\u003c/p\u003e\n"],["\u003cp\u003eDialogflow can act as a proxy between Actions on Google and your fulfillment, handling the communication and format conversions.\u003c/p\u003e\n"]]],["Actions on Google uses webhooks to communicate with fulfillment services, sending HTTP POST requests with JSON payloads. Fulfillment services must parse these requests and respond with appropriately formatted JSON. There are two main webhook formats: Dialogflow and Conversation, corresponding to whether Dialogflow acts as a proxy. Webhook requests can be invocations, conversation turns, or helper results. The fulfillment reads parameters from the request payload and sends a reply back to the Assistant.\n"],null,["# Actions on Google webhook formats (Dialogflow)\n\nThis document describes the webhook format for communicating between Actions on Google\nand a fulfillment service that defines a custom [conversational user interface](/assistant/df-asdk/design).\n| **Note:** If you have a Node.js backend server, we strongly encourage you to use the [Actions on Google Node.js client library](/assistant/df-asdk/reference/nodejsv2/overview) to simplify creating your webhook. The client library provides a wrapper for the webhook format. If you prefer to roll your own backend implementation without using the client library, your backend is responsible for consuming and processing the JSON messages sent by Actions on Google via HTTP POST.\n\nIt's important to understand how Actions on Google and your fulfillment communicate\nthrough the Actions on Google webhook formats:\n\n- To participate in conversations with Actions on Google, your fulfillment implements a [webhook](https://en.wikipedia.org/wiki/Webhook) that can respond to HTTP requests from Actions on Google.\n- When users invoke your Action, your fulfillment receives an [`HTTP POST`](https://en.wikipedia.org/wiki/POST_(HTTP)) with a JSON payload that describes the user's request.\n- In turn, your fulfillment is responsible for reading the parameters from the request payload, generating an appropriate JSON formatted response, and sending a reply to the Assistant with this response.\n\n| **Key Terms:**\n|\n| - **Dialogflow webhook format:** JSON payload format when Actions on Google invokes your fulfillment through [Dialogflow](//dialogflow.com/).\n| - **Conversation webhook format:** JSON payload format when Actions on Google invokes your fulfillment through the [Actions SDK](/assistant/df-asdk/actions-sdk).\n\nRequest types\n-------------\n\nThis table summarizes the types of requests that your webhook might receive\nfrom the Assistant:\n\n| Type | Description | JSON Examples |\n|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Invocation requests | User utterances that initiate the conversation with your fulfillment or trigger deep-link Actions (for example, *\"Talk to Personal Chef to find dinner recipes\"* ). - If using Dialogflow, these requests correspond to the intents defined in the **Discovery** section of the **Google Assistant** integration settings. - If using the Actions SDK, these requests correspond to the intents defined in your [Action package](/assistant/df-asdk/reference/action-package/rest/Shared.Types/ActionPackage). | - [Dialogflow webhook](/assistant/df-asdk/reference/dialogflow-webhook-json#simple-invocation-request-example-df) - [Conversation webhook](/assistant/df-asdk/reference/conversation-webhook-json#simple-invocation-request-example-conv) |\n| Conversation requests | Utterances by users in the same session once the conversation with your fulfillment has started. In the conversation webhook format, these are the raw text responses from the user corresponding to `actions.intent.TEXT` intents that your fulfillment requested in the previous turn. | - [Dialogflow webhook](/assistant/df-asdk/reference/dialogflow-webhook-json#simple-conversation-request-example-df) - [Conversation webhook](/assistant/df-asdk/reference/conversation-webhook-json#simple-conversation-request-example-conv) |\n| Helper results | Requests sent by the Assistant to your fulfillment when your webhook has requested a [helper intent](/assistant/df-asdk/helpers) in the previous turn of the conversation to handle parts of the conversation (for example, `actions.intent.OPTION` and `actions.intent.PERMISSION`). | - [Dialogflow webhook](/assistant/df-asdk/reference/dialogflow-webhook-json#helper-result-example-df) - [Conversation webhook](/assistant/df-asdk/reference/conversation-webhook-json#helper-example-conv) |\n\nConversation requests and responses\n-----------------------------------\n\nIn a typical Actions on Google interaction scenario, users utter a phrase to invoke an\nAction. To provide a response, Actions on Google finds the fulfillment that matches the\nAction invoked by the user and sends the request there.\n\nOnce Actions on Google establishes that your fulfillment is a suitable match for the\nuser's invocation, it starts a conversation session by sending an HTTP request\nthat contains a JSON payload with the user's request information to your\nfulfillment endpoint. Your fulfillment parses the request and returns a response\nthat contains a JSON payload. Actions on Google then converts the payload into rendered\nspeech and multimedia output for users.\n**Figure 1.** Actions on Google invoking your fulfillment through the Actions SDK.\n\nTo learn more about the format of the JSON payload when Actions on Google invokes your\nfulfillment through the Actions SDK, see [Conversation webhook format](/assistant/df-asdk/reference/conversation-webhook-json).\n\nDialogflow requests and responses\n---------------------------------\n\nWhen you create Actions, you can optionally use Dialogflow to simplify the\ntask of building conversational interfaces. In this scenario, Dialogflow acts as\na proxy between Actions on Google and your fulfillment. Instead of sending the HTTP/JSON\nrequest directly to your fulfillment endpoint, Actions on Google sends it to\nDialogflow.\n\nDialogflow wraps the JSON payload contained in the original request into the\nDialogflow webhook format, and forwards the resulting request to your Dialogflow\nfulfillment.\n\nConversely, when your fulfillment sends a response to Dialogflow, the JSON\npayload of the response must comply with the Dialogflow webhook format. Your\nfulfillment parses the parameters from the Dialogflow JSON request, and\ngenerates a response in the Dialogflow webhook format. Dialogflow then converts\nthe response from your fulfillment into a response message that the Assistant\nunderstands.\n**Figure 2.** Actions on Google invoking your fulfillment through Dialogflow.\n\nTo learn more about the format of the JSON payload when Actions on Google invokes your\nfulfillment through Dialogflow, see [Dialogflow webhook format](/assistant/df-asdk/reference/dialogflow-webhook-json)."]]