تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
تحدِّد الطلبات طريقة عرض الإجراء الخاص بك للردود للمستخدمين وطريقة عرض الإجراء.
وتحثه على المتابعة. أثناء إنشاء الإجراء، يمكنك إضافة الطلبات إلى
الدعوات إلى الأماكن المختلفة داخل المشاهد. يمكن أن تكون المطالبات بسيطة مثل
أو يمكن أن تكون أكثر تعقيدًا وتتضمن محتوى وافيًا مثل
والبطاقات والصور والجداول.
أنواع الردود
لكل طلب، يمكنك الاختيار من بين مجموعة متنوعة من أنواع الردود التفاعلية
"مساعد Google" ليعرض للمستخدمين ما يلي:
ردود بسيطة: تظهر الردود البسيطة على شكل فقاعة محادثة
واستخدام ميزة تحويل النص إلى كلام (TTS) أو لغة ترميز تركيب الكلام (SSML)
صَوْت. وتجدر الإشارة إلى أن الردود البسيطة هي الردود الوحيدة المتوافقة مع جميع أنواع الأجهزة.
الردود المنسّقة: الردود المنسّقة التي تتضمن عناصر مرئية أو وظيفية
تحسِّن تفاعلات المستخدمين مع الإجراءات. باستخدام الردود الغنية، يمكنك أيضًا
عرض بيانات جدولية أو تشغيل محتوى صوتي أطول.
ردود الاختيار المرئي: توفّر ردود الاختيار المرئي صورًا
للمستخدمين للاختيار من بين خيارات متعددة أسهل
مختلفة من خلال عنوانها أو بصورة.
ردود الوسائط: تتيح الردود على الوسائط تشغيل الصوت لمدة أطول في "الإجراءات"
أكثر من SSML وتوفر مكوِّنًا مرئيًا مع عناصر التحكم في الوسائط.
لوحة الرسم التفاعلية: تعرض ميزة "لوحة الرسم التفاعلية" الردود في وضع ملء الشاشة
الويب ويعمل كتطبيق ويب تفاعلي يرسله "مساعد Google"
الرد على المستخدم في المحادثة. تستخدم لوحة الرسم طلبًا مختلفًا قليلاً
لاستيعاب المرونة الإضافية من معايير الويب مثل HTML وCSS
JavaScript.
يستخدم كل نوع من أنواع الردود هذه تنسيق الطلب الأساسي نفسه ويمكنه الوصول إلى
نفس الميزات العامة الموضحة أدناه.
تنسيق الطلب
في مشروع "الإجراءات"، يمكنك تحديد الطلبات بتنسيق YAML أو JSON. على كل
يمكن أن يحتوي على ما يصل إلى ردين بسيطين، ويمكنك تحديد
الاستجابة. ويتم تحديد الردود بالطرق التالية:
first_simple: الاستجابة الأولية للنص أو الكلام (البسيط) لإرساله إلى المستخدم.
content: محتوى استجابة غنية تكميلي لإرساله بعد ردود بسيطة.
last_simple الردّ النهائي أو الكلام (البسيط) لإرساله إلى المستخدم
canvas: يشير إلى تطبيق ويب يتكامل مع "لوحة الرسم التفاعلية".
يتم إلحاق الطلبات تلقائيًا ببعضها البعض بالترتيب أعلاه في رسالة مطالبة.
قائمة الانتظار. قبل أن يتمكّن المستخدم من الردّ، يقدّم "مساعد Google" للمستخدم كل الطلبات.
في قائمة انتظار المطالبات.
بالإضافة إلى ذلك، توفّر مرونة في الطلب باستخدام الميزات التالية:
المرشحون: يسمح لك المرشحون بتحديد الردود استنادًا إلى
إمكانيات جهاز المستخدم. على سبيل المثال، يمكنك استخدام "مساعد Google" لعرض إعلانات تفاعلية
الردود فقط عندما يتفاعل المستخدم مع الإجراء على شاشة قابلة للعرض
الخاص بك.
الصيغ: الصيغ هي صيغ بديلة لرسالة واحدة.
على سبيل المثال، يمكنك أن تطلب من "مساعد Google" الاختيار من بين خمس عبارات ترحيب مختلفة.
صيغ الرسالة في كل مرة يستدعي فيها أحد المستخدمين الإجراء الخاص بك.
الاقتراحات: توفّر الاقتراحات للمستخدمين إمكانية عرض الإعلانات.
الأجهزة التي تتضمّن شرائح اقتراحات عندما يعرض "مساعد Google" الطلب
يستخدم الطلب التلقائي عنصرًا محفّزًا واحدًا وخيارًا واحدًا وردّ first_simple.
المرشحون
في الطلب، يسمح لك الكائن candidates بتحديد الردود استنادًا إلى
إمكانيات جهاز المستخدم. على سبيل المثال، يمكنك استخدام "مساعد Google" لعرض إعلانات تفاعلية
الردود فقط عندما يتفاعل المستخدم مع الإجراء على شاشة قابلة للعرض
الخاص بك. لتحديد أنواع الأجهزة التي يمكن لخدمة "مساعد Google" من خلالها عرض أحد الأجهزة المرشّحة، يُرجى استخدام
السمة selector لكائن candidates.
في المثال أدناه، تحتوي السمة selector على إمكانات الجهاز.
المعلومات. إنّ الطلبات التي تم تحديدها في أول عنصر محفّز يتم إرسالها إلى المستخدمين على أحد الأجهزة.
التي يمكنها تقديم ردود مفيدة ويحتوي المرشح الثاني على مطالبات
المستخدمين الذين يمكنهم فقط تلقي الردود النصية والكلامية.
YAML
candidates:-selector:surface_capabilities:capabilities:-RICH_RESPONSEfirst_simple:variants:-speech:Here's a simple message.content:card:title:Image card titletext:Some details about the imageimage:url:'https://www.example.com/image/'-first_simple:variants:-speech:Text explains what the image might have shown in more detail.
JSON
{"candidates":[{"selector":{"surface_capabilities":{"capabilities":["RICH_RESPONSE"]}},"first_simple":{"variants":[{"speech":"Here's a simple message."}]},"content":{"card":{"title":"Image card title","text":"Some details about the image","image":{"url":"https://www.example.com/image/"}}}},{"first_simple":{"variants":[{"speech":"Text explains what the image might have shown in more detail."}]}}]}
ويمكنك تقديم متطلب واحد أو أكثر من متطلبات الكفاءة لمرشح معيّن. تشير رسالة الأشكال البيانية
تصف القائمة التالية كلاً من متطلبات الإمكانات المتاحة:
SPEECH: يستطيع الجهاز التحدّث إلى المستخدم عبر تحويل النص إلى كلام أو SSML.
RICH_RESPONSE: يستطيع الجهاز عرض ردود غنية بصريًا، مثل البطاقات والقوائم.
الجداول.
LONG_FORM_AUDIO: يمكن للجهاز تشغيل وسائط صوتية طويلة مثل الموسيقى
مقاطع البودكاست.
INTERACTIVE_CANVAS: يمكن للجهاز عرض رد من لوحة الرسم التفاعلية.
WEB_LINK: يمكن للجهاز استخدام روابط الويب في الردود المنسّقة لفتح متصفّح ويب.
توفِّر الصِيَغ طريقة لتحديد نُسَخ متعددة من الردّ. عند استخدام "مساعد Google"
لإرسال الطلب إلى المستخدم، يتم اختيار إحدى الصيغ عشوائيًا. من أفضل الألعاب
التدريب في تصميم المحادثة، وتوفر للمستخدمين ردودًا بديلة عند
يتحدث مع الإجراء الخاص بك.
على سبيل المثال، قدِّم صيغًا مختلفة لرسالة الترحيب حتى لا يسمع المستخدمون
الاستجابة نفسها في كل مرة يستدعي فيها الإجراء الخاص بك:
توفِّر الاقتراحات للمستخدمين على الأجهزة التي تمكِّن العرض شرائح اقتراحات عند
يعرض "مساعد Google" الطلب. استخدام شرائح الاقتراحات لتعديل ردود المستخدمين
لمتابعة المحادثة أو تغييرها. عند النقر على شريحة الاقتراح، تعرض
عرض النص إلى المحادثة حرفيًا، كما لو كان المستخدم قد كتبه.
يمكن أن يكون لديك 8 اقتراحات كحد أقصى في طلب واحد، على أن يكون لكل اقتراح حد أقصى.
طول 25 حرفًا في النص العادي.
لإضافة اقتراح، قدِّم عنصر Suggestion يحتوي على كل عنصر.
اقتراح في حقل title منفصل. يجب أن يكون كل عنوان فريدًا بين المجموعة.
من شرائح الاقتراحات في أداة إنشاء الإجراءات، يتم تمثيل هذا الكائن بترميز YAML
JSON بتنسيق suggestions
على سبيل المثال، يمكنك إدخال "نعم" و"لا" اقتراحات بجانب سؤال:
تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003ePrompts control how Google Assistant interacts with users in your Action, using a variety of response types like simple text, rich cards, visual selections, media, and interactive canvases.\u003c/p\u003e\n"],["\u003cp\u003ePrompts are structured with elements like \u003ccode\u003efirst_simple\u003c/code\u003e, \u003ccode\u003econtent\u003c/code\u003e, \u003ccode\u003elast_simple\u003c/code\u003e, and \u003ccode\u003ecanvas\u003c/code\u003e, allowing for basic and enhanced responses depending on device capabilities.\u003c/p\u003e\n"],["\u003cp\u003eYou can tailor prompts with candidates for specific device types, variants for diverse responses, and suggestions to guide user interactions.\u003c/p\u003e\n"],["\u003cp\u003eCandidates determine the response based on device capabilities, such as showing rich responses only on devices that support them.\u003c/p\u003e\n"],["\u003cp\u003eVariants offer alternative phrasing for the same message, while suggestions provide clickable chips to guide user responses.\u003c/p\u003e\n"]]],[],null,["# Prompts define how your Action renders responses to users and how your Action\nprompts them to continue. As you build your Action, you can add prompts to\ninvocations and to various places within scenes. Prompts can be as simple as a\ntext or speech response, or can be more complex and contain rich content like\ncards, images, and tables.\n\nResponse types\n--------------\n\nFor each prompt, you select from a variety of engaging response types for\nAssistant to present to users:\n\n- [Simple responses](/assistant/conversational/prompts-simple): Simple responses take the form of a chat bubble visually and use text-to-speech (TTS) or Speech Synthesis Markup Language (SSML) for sound. Simple responses are the only responses supported on all device types.\n- [Rich responses](/assistant/conversational/prompts-rich): Rich responses contain visual or functional elements that enhance user interactions with your Actions. With rich responses, you can also display tabular data or play longer-form audio content.\n- [Visual selection responses](/assistant/conversational/prompts-selection): Visual selection responses provide a visual interface for users to choose between multiple options that are most easily differentiated by their title or by an image.\n- [Media responses](/assistant/conversational/prompts-media): Media responses let your Actions play longer form audio content than [SSML](/assistant/conversational/ssml), and provide a visual component with media controls.\n- [Interactive Canvas](/assistant/interactivecanvas): Interactive Canvas renders responses as full-screen web views and functions as an interactive web app that Assistant sends as a response to the user in conversation. Canvas uses a slightly different prompt format to accommodate added flexibility from web standards like HTML, CSS, and JavaScript.\n\nEach of these response types uses the same base prompt format and has access to\nthe same general features described below.\n\nFormat of a prompt\n------------------\n\nIn your Actions project, you define prompts in either YAML or JSON format. Each\nprompt can contain up to two simple responses, and optionally define a rich\nresponse. Responses are defined in the following ways:\n\n- `first_simple`: Initial text or speech (simple) response to send to the user.\n- `content`: Supplemental rich response content to send after simple responses.\n- `last_simple` Final text or speech (simple) response to send to the user.\n- `canvas`: References a web app that integrates with Interactive Canvas.\n\nBy default, prompts are appended to one another in the above order in a prompt\nqueue. Before the user can respond, Assistant presents the user with all prompts\nin the prompt queue.\n\nYou additionally provide flexibility to the prompt using the following features:\n\n- [Candidates](#candidates): Candidates allow you to define responses based on a user's device capabilities. For example, you can have Assistant display rich responses only when a user interacts with your Action on a display-capable device.\n- [Variants](#variants): Variants are alternate variations of a single message. For example, you can have Assistant choose between five different welcome message variants each time a user invokes your Action.\n- [Suggestions](#suggestions): Suggestions provide users on display-capable devices with suggestion chips when Assistant displays the prompt.\n\nA default prompt uses one candidate, one variant, and a `first_simple` response.\n| **Note:** As a best practice, use `content` to support the `first_simple` response. For example, if the `first_simple` provides options for ordering a drink, you can use `content` to provide visuals for the drink options. This approach ensures users get the important information regardless of which device they use. Alternatively, use candidates to provide different responses based on device.\n\nCandidates\n----------\n\nIn a prompt, the `candidates` object allows you to define responses based on a\nuser's device capabilities. For example, you can have Assistant display rich\nresponses only when a user interacts with your Action on a display-capable\ndevice. To define the device types where Assistant can return a candidate, use\nthe `selector` property of the `candidates` object.\n\nIn the example below, the `selector` property contains the device capability\ninformation. Prompts set in the first candidate are sent to users on a device\nthat can render rich responses. The second candidate contains prompts for\nusers that can only receive text and speech responses. \n\n### YAML\n\n```yaml\ncandidates:\n - selector:\n surface_capabilities:\n capabilities:\n - RICH_RESPONSE\n first_simple:\n variants:\n - speech: Here's a simple message.\n content:\n card:\n title: Image card title\n text: Some details about the image\n image:\n url: 'https://www.example.com/image/'\n - first_simple:\n variants:\n - speech: Text explains what the image might have shown in more detail.\n \n```\n\n### JSON\n\n```gdscript\n{\n \"candidates\": [{\n \"selector\": {\n \"surface_capabilities\": {\n \"capabilities\": [\"RICH_RESPONSE\"]\n }\n },\n \"first_simple\": {\n \"variants\": [{\n \"speech\": \"Here's a simple message.\"\n }]\n },\n \"content\": {\n \"card\": {\n \"title\": \"Image card title\",\n \"text\": \"Some details about the image\",\n \"image\": {\n \"url\": \"https://www.example.com/image/\"\n }\n }\n }\n }, {\n \"first_simple\": {\n \"variants\": [{\n \"speech\": \"Text explains what the image might have shown in more detail.\"\n }]\n }\n }]\n}\n \n```\n\nYou can provide one or more capability requirements for a given candidate. The\nfollowing list describes each of the available capability requirements:\n\n- `SPEECH`: Device can speak to the user via text-to-speech or SSML.\n- `RICH_RESPONSE`: Device can display rich responses like cards, lists, and tables.\n- `LONG_FORM_AUDIO`: Device can play long form audio media like music and podcasts.\n- `INTERACTIVE_CANVAS`: Device can display an Interactive Canvas response.\n- `WEB_LINK`: Device can use web links in rich responses to open a web browser.\n- `HOME_STORAGE`: Device can store to and access data from [home storage](/assistant/conversational/storage-home).\n\nVariants\n--------\n\nVariants provide a way to define multiple versions of a response. When Assistant\nsends the prompt to a user, one of the variants is chosen at random. As a best\npractice in conversation design, provide users with alternate responses when\nthey converse with your Action.\n\nFor example, provide different welcome message variants so users don't hear the\nsame response each time they invoke your Action: \n\n### YAML\n\n```yaml\ncandidates:\n - first_simple:\n variants:\n - speech: Hello.\n - speech: Hi there.\n - speech: Welcome.\n \n```\n\n### JSON\n\n```gdscript\n{\n \"candidates\": [{\n \"first_simple\": {\n \"variants\": [{\n \"speech\": \"Hello.\"\n },{\n \"speech\": \"Hi there.\"\n },{\n \"speech\": \"Welcome.\"\n }]\n }\n }]\n}\n \n```\n\nSuggestions\n-----------\n\nSuggestions provide users on display-capable devices with suggestion chips when\nAssistant displays the prompt. Use suggestion chips to hint at user responses to\ncontinue or pivot the conversation. When tapped, a suggestion chip returns the\ndisplayed text to the conversation verbatim, as if the user had typed it.\n\nYou may have a maximum of 8 suggestions in a single prompt, each with a maximum\nlength of 25 plaintext characters.\n\nTo add a suggestion, provide a [`Suggestion`](/assistant/actionssdk/reference/rest/Shared.Types/EventHandler#suggestion) object that contains each\nsuggestion in a separate `title` field. Each title must be unique among the set\nof suggestion chips. In Actions Builder, this object is represented in YAML and\nJSON as `suggestions`.\n\nFor example, you can provide \"Yes\" and \"No\" suggestions alongside a question: \n\n### YAML\n\n```yaml\ncandidates:\n - first_simple:\n variants:\n - speech: 'Welcome, do you want to play a game?'\n suggestions:\n - title: 'Yes'\n - title: 'No'\n \n```\n\n### JSON\n\n```gdscript\n{\n \"candidates\": [{\n \"first_simple\": {\n \"variants\": [{\n \"speech\": \"Welcome, do you want to play a game?\"\n }]\n },\n \"suggestions\": [{\n \"title\": \"Yes\"\n }, {\n \"title\": \"No\"\n }]\n }]\n}\n \n```"]]