Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Şekil 1. Etkileşimli Tuval kullanılarak oluşturulmuş etkileşimli bir oyun.
Etkileşimli Tuval, Google Asistan üzerinde geliştirilen ve geliştiricilerin Görüşme İşlemlerine görsel ve etkileyici deneyimler eklemesine olanak tanıyan bir çerçevedir. Bu görsel deneyim, Asistan'ın görüşmede kullanıcıya yanıt olarak gönderdiği etkileşimli bir web uygulamasıdır. Bir Asistan görüşmesinde satır içi olarak bulunan zengin yanıtların aksine
Etkileşimli Tuval web uygulaması, tam ekran web görünümü olarak oluşturulur.
İşleminizde aşağıdakilerden birini yapmak istiyorsanız Etkileşimli Tuval'i kullanın:
Tam ekran görseller oluşturma
Özel animasyonlar ve geçişler oluşturma
Veri görselleştirme işlemi yapın
Özel düzenler ve GUI'ler oluşturun
Desteklenen cihaz sayısı
Etkileşimli Tuval şu anda aşağıdaki cihazlarda kullanılabilir:
Akıllı ekranlar
Android mobil cihazlar
İşleyiş şekli
Etkileşimli Tuval kullanan bir İşlem iki ana bileşenden oluşur:
Konuşma İşlemi: Kullanıcı isteklerini gerçekleştirmek için bir konuşma arayüzü kullanan işlem. Görüşmenizi oluşturmak için Actions Builder veya Actions SDK'yı kullanabilirsiniz.
Web uygulaması: İşleminizin kullanıcılara görüşme sırasında yanıt olarak gönderdiği, özelleştirilmiş görsellere sahip bir kullanıcı arabirimi web uygulaması. Web uygulamasını HTML, JavaScript ve CSS gibi web teknolojileriyle oluşturursunuz.
Etkileşimli bir Tuval İşlemi ile etkileşimde bulunan kullanıcılar, hedeflerine ulaşmak için Google Asistan'la karşılıklı iletişim kurar. Ancak Etkileşimli Tuval için bu görüşmenin büyük kısmı web uygulamanızın bağlamında gerçekleşir. Görüşme İşleminizi web uygulamanıza bağlarken web uygulaması kodunuza Interactive Canvas API'yi eklemeniz gerekir.
Etkileşimli Tuval kitaplığı: Bir API kullanarak web uygulaması ile Görüşme İşleminiz arasında iletişim sağlamak için web uygulamasına eklediğiniz bir JavaScript kitaplığı. Daha fazla bilgi için Interactive Canvas API dokümanlarına bakın.
Etkileşimli web kitaplığını eklemenin yanı sıra, web uygulamanızı kullanıcının cihazında açmak için görüşmenizde Canvas yanıt türünü döndürmeniz gerekir. Ayrıca, web uygulamanızı kullanıcının girişine göre güncellemek için bir Canvas yanıtı da kullanabilirsiniz.
Canvas: Web uygulamasının URL'sini ve iletilecek verileri içeren bir yanıt. Actions Builder, web uygulamasını güncellemek için Canvas yanıtını eşleşen amaç ve mevcut sahne verileriyle otomatik olarak doldurabilir. Alternatif olarak Node.js istek karşılama kitaplığını kullanarak bir webhook'tan Canvas yanıtı gönderebilirsiniz. Daha fazla bilgi için Canvas istemleri bölümüne bakın.
Etkileşimli Tuval'in işleyiş şeklini göstermek için Havalı Renkler adlı ve cihazın ekran rengini, kullanıcının belirttiği bir renge dönüştüren varsayımsal bir İşlem düşünün. Kullanıcı Action'ı çağırdıktan sonra aşağıdaki akış gerçekleşir:
Kullanıcı, Asistan cihazına "Ekranı mavi yap" ifadesini gösterir.
Actions on Google platformu, kullanıcının isteğini bir niyetle eşleşecek şekilde sohbet mantığınıza yönlendirir.
Platform, niyeti İşlemin sahnesiyle eşleştirir. Böylece etkinlik tetiklenir ve cihaza Canvas yanıtı gönderilir. Cihaz, yanıtta sağlanan bir URL'yi (henüz yüklenmediyse) kullanarak bir web uygulaması yükler.
Web uygulaması yüklendiğinde, geri çağırmalar Interactive Canvas API'yle kaydedilir.
Tuval yanıtı bir data alanı içeriyorsa data alanının nesne değeri, web uygulamasının kayıtlı onUpdate geri çağırmasına iletilir. Bu örnekte, konuşma mantığı, blue değerine sahip bir değişken içeren veri alanına sahip bir Canvas yanıtı gönderir.
Canvas yanıtının data değerini aldıktan sonra onUpdate geri çağırma, web uygulamanız için özel mantık yürütebilir ve tanımlanan değişiklikleri yapabilir. Bu örnekte onUpdate geri çağırma data öğesinden rengi okur ve ekranı maviye çevirir.
İstemci ve sunucu tarafında sipariş karşılama
Etkileşimli Tuval İşlemi oluştururken iki sipariş karşılama uygulama yolu arasından seçim yapabilirsiniz: sunucu sipariş karşılama veya istemci sipariş karşılama. Sunucu yerine getirmede öncelikle webhook gerektiren API'leri kullanırsınız. İstemci memnuniyeti sayesinde istemci taraflı API'leri ve gerekirse Canvas dışı özellikler (hesap bağlama gibi) için webhook gerektiren API'leri kullanabilirsiniz.
Proje oluşturma aşamasında sunucu webhook'u karşılama özelliğiyle derleme yapmayı seçerseniz web uygulamasını güncellemek ve ikisi arasındaki iletişimi yönetmek için konuşma mantığı ve istemci taraflı JavaScript'i işlemek amacıyla bir webhook dağıtmanız gerekir.
İstemci karşılama (şu anda Geliştirici Önizlemesi ile kullanılabiliyor) ile derlemeyi tercih ederseniz Action'ınızın mantığını yalnızca web uygulamasında oluşturmak için yeni istemci tarafı API'lerini kullanabilirsiniz. Böylece geliştirme deneyimi basitleştirilir, görüşme sırasındaki geçişler arasındaki gecikme azalır ve cihaz üzerinde özellikleri kullanabilirsiniz. Gerekirse istemciden sunucu tarafı mantığına da geçebilirsiniz.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2023-05-16 UTC."],[[["\u003cp\u003eInteractive Canvas is a framework by Google Assistant to build interactive, full-screen web apps for visual experiences within Conversational Actions.\u003c/p\u003e\n"],["\u003cp\u003eIt is currently supported on smart displays and Android mobile devices and is primarily used for gaming, storytelling, and educational experiences.\u003c/p\u003e\n"],["\u003cp\u003eInteractive Canvas Actions utilize a conversational interface paired with a web app, communicating using the Interactive Canvas API for dynamic updates.\u003c/p\u003e\n"],["\u003cp\u003eYou can implement your Action's logic using either server fulfillment (webhooks) or client fulfillment (client-side APIs).\u003c/p\u003e\n"],["\u003cp\u003eFor detailed guidance and a sample project, refer to the web apps documentation and the GitHub sample.\u003c/p\u003e\n"]]],[],null,["# Interactive Canvas\n\n**Figure 1.** An interactive game built using Interactive Canvas.\n\nInteractive Canvas is a framework built on Google Assistant that allows\ndevelopers to add visual, immersive experiences to Conversational Actions. This visual\nexperience is an interactive web app that Assistant sends as a response to the\nuser in conversation. Unlike [rich responses](/assistant/conversational/prompts-rich) that exist in-line in an\nAssistant conversation, the Interactive Canvas web app renders as a full-screen\nweb view.\n\nUse Interactive Canvas if you want to do any of the following in your Action:\n\n- Create full-screen visuals\n- Create custom animations and transitions\n- Do data visualization\n- Create custom layouts and GUIs\n\n| **Note:** At this time, Google is only approving Actions that use Interactive Canvas for gaming, storytelling, and educational experiences. Actions that use Interactive Canvas also take slightly longer for Google's review team to test and approve. Allow extra time in your release process to account for this.\n\nSupported devices\n-----------------\n\nInteractive Canvas is currently available on the following devices:\n\n- Smart displays\n- Android mobile devices\n\n| **Note:** For Canvas to work on Android mobile devices, your Android Google Search App (AGSA) must be version 9.86 or later.\n\nHow it works\n------------\n\nAn Action that uses Interactive Canvas consists of two main components:\n\n- **Conversational Action:** An Action that uses a conversational interface to fulfill user requests. You can use either [Actions Builder](/assistant/conversational/build#actions_builder) or the [Actions SDK](/assistant/conversational/build#actions_sdk) to build your conversation.\n- **Web app:** A front-end web app with customized visuals that your Action sends as a response to users during a conversation. You build the web app with web technologies like HTML, JavaScript, and CSS.\n\nUsers interacting with an Interactive Canvas Action have a back-and-forth\nconversation with Google Assistant to fulfill their goal. However, for\nInteractive Canvas, the bulk of this conversation occurs within the context of\nyour web app. When connecting your Conversational Action to your web app, you must include\nthe **Interactive Canvas API** in your web app code.\n\n- **Interactive Canvas library:** A JavaScript library that you include in the web app to enable communication between the web app and your Conversational Action using an API. For more information, see the [Interactive Canvas API documentation](/assistant/interactivecanvas/reference).\n\nIn addition to including the Interactive Canvas library, you must return the\n[`Canvas`](/assistant/conversational/reference/rest/v1/TopLevel/fulfill#canvas) response type in your conversation to open your web app on the\nuser's device. You can also use a `Canvas` response to update your web app based\non the user's input.\n\n- **`Canvas`:** A response that contains a URL of the web app and data to pass it. Actions Builder can automatically populate the `Canvas` response with the matched intent and current scene data to update the web app. Alternatively, you can send a `Canvas` response from a webhook using the [Node.js fulfillment library](https://actions-on-google.github.io/assistant-conversation-nodejs/3.0.0/classes/_conversation_prompt_canvas_.canvas.html). For more information, see [Canvas prompts](/assistant/interactivecanvas/prompts).\n\nTo illustrate how Interactive Canvas works, imagine a hypothetical Action\ncalled *Cool Colors* that changes the device screen color to a color the user\nspecifies. After the user invokes the Action, the following flow happens:\n\n1. The user says, *\"Turn the screen blue.\"* to the Assistant device.\n2. The Actions on Google platform routes the user's request to your conversational logic to match an intent.\n3. The platform matches the intent with the Action's scene, which triggers an event and sends a `Canvas` response to the device. The device loads a web app using a URL provided in the response (if it has not yet been loaded).\n4. When the web app loads, it registers callbacks with the Interactive Canvas API. If the Canvas response contains a `data` field, the object value of the `data` field is passed into the registered `onUpdate` callback of the web app. In this example, the conversational logic sends a `Canvas` response with a data field that includes a variable with the value of `blue`.\n5. Upon receiving the `data` value of the `Canvas` response, the `onUpdate` callback can execute custom logic for your web app and make the defined changes. In this example, the `onUpdate` callback reads the color from `data` and turns the screen blue.\n\nClient-side and server-side fulfillment\n---------------------------------------\n\n| **Warning:** Some client-side APIs listed in this documentation are in Developer Preview. You can test these APIs in the simulator, but do not deploy an Action that uses this feature to alpha, beta, or production channels. Actions deployed using these features will not function on end-user devices.\n\nWhen building an Interactive Canvas Action, you can choose between two fulfillment\nimplementation paths: server fulfillment or client fulfillment. With server\nfulfillment, you primarily use APIs that require a webhook. With client fulfillment,\nyou can use client-side APIs and, if needed, APIs that require a webhook for\nnon-Canvas features (such as account linking).\n\nIf you choose to build with [**server webhook fulfillment**](/assistant/interactivecanvas/prompts#enable_interactive_canvas) in\nthe project creation stage, you must deploy a webhook to handle the conversational\nlogic and client-side JavaScript to update the web app and manage communication\nbetween the two.\n\nIf you choose to build with [**client fulfillment**](/assistant/interactivecanvas/prompts#enable_interactive_canvas)\n(currently available in Developer Preview), you can use new client-side APIs to\nbuild your Action's logic exclusively in the web app, which simplifies the\ndevelopment experience, reduces latency between conversational turns, and\nenables you to use on-device capabilities. If needed, you can also switch to\nserver-side logic from the client.\n\nFor more information about client-side capabilities, see\n[Build with client-side fulfillment](/assistant/interactivecanvas/fulfillment#build_with_client-side_fulfillment).\n\nNext steps\n----------\n\nTo learn how to build a web app for Interactive Canvas, see [Web apps](/assistant/interactivecanvas/web-apps).\n\nTo see the code for a complete Interactive Canvas Action, see the\n[sample on GitHub](https://github.com/actions-on-google/actions-builder-canvas-nodejs)."]]