הדף הזה מסביר איך לבנות דף בית אפליקציית Google Chat. דף הבית של האפליקציה הוא ממשק כרטיסים שניתן להתאים אישית שאפליקציית Chat שולחת למשתמש כשהוא פותח הודעה עם אפליקציית Chat.
לדוגמה, אפשר: להגדיר את ההודעה של כרטיס הבית של האפליקציה כך שתכלול טיפים לאינטראקציה עם אפליקציית Chat משתמשת פקודות דרך שורת הפקודות. למשתמשי הקצה, דף הבית של האפליקציה זמינה בצ'אט אישי של אפליקציית Chat רק אם מפעיל אפליקציות מפעיל את התכונה.
אתם יכולים להשתמש בכלי ליצירת כרטיסים כדי לעצב הודעות של כרטיסי JSON ולהציג אותן בתצוגה מקדימה בשביל אפליקציות ל-Chat:
לפתיחת הכלי ליצירת כרטיסיםדרישות מוקדמות
Python
אפליקציית Google Chat שמופעלת בה תכונות אינטראקטיביות. כדי ליצור להשתמש בשירות HTTP באפליקציית Chat האינטראקטיבית. במדריך למתחילים מוסבר איך עושים את זה.
Apps Script
אפליקציית Google Chat שמופעלת בה תכונות אינטראקטיביות. כדי ליצור כדי להשתמש באפליקציית Chat האינטראקטיבית ב-Apps Script, צריך להשלים את המדריך למתחילים.
Node.js
אפליקציית Google Chat שמופעלת בה תכונות אינטראקטיביות. כדי ליצור להשתמש בשירות HTTP באפליקציית Chat האינטראקטיבית. במדריך למתחילים מוסבר איך עושים את זה.
Java
אפליקציית Google Chat שמופעלת בה תכונות אינטראקטיביות. כדי ליצור להשתמש בשירות HTTP באפליקציית Chat האינטראקטיבית. במדריך למתחילים מוסבר איך עושים את זה.
הגדרה של Chat API
כדי לתמוך בדף הבית של האפליקציה, צריך לעדכן את ההגדרה של Chat API במסוף Google Cloud.
Python
במסוף Google Cloud, נכנסים אל תפריט > עוד מוצרים > Google Workspace > ספריית המוצרים > Google Chat API.
לוחצים על Manage (ניהול) ואז לוחצים על הכרטיסייה Configuration (הגדרה).
מסמנים את התיבה Support App Home.
בשדה כתובת ה-URL של דף הבית של האפליקציה, מוסיפים כתובת URL. בדרך כלל הערך הזה זהה בתור כתובת ה-URL של האפליקציה. כתובת ה-URL הזו נקראת
APP_HOME
אירועים.לוחצים על שמירה.
Apps Script
במסוף Google Cloud, נכנסים אל תפריט > עוד מוצרים > Google Workspace > ספריית המוצרים > Google Chat API.
לוחצים על Manage (ניהול) ואז לוחצים על הכרטיסייה Configuration (הגדרה).
מסמנים את התיבה Support App Home.
לוחצים על שמירה.
Node.js
במסוף Google Cloud, נכנסים אל תפריט > עוד מוצרים > Google Workspace > ספריית המוצרים > Google Chat API.
לוחצים על Manage (ניהול) ואז לוחצים על הכרטיסייה Configuration (הגדרה).
מסמנים את התיבה Support App Home.
בשדה כתובת ה-URL של דף הבית של האפליקציה, מוסיפים כתובת URL. בדרך כלל הערך הזה זהה בתור כתובת ה-URL של האפליקציה. כתובת ה-URL הזו נקראת
APP_HOME
אירועים.לוחצים על שמירה.
Java
במסוף Google Cloud, נכנסים אל תפריט > עוד מוצרים > Google Workspace > ספריית המוצרים > Google Chat API.
לוחצים על Manage (ניהול) ואז לוחצים על הכרטיסייה Configuration (הגדרה).
מסמנים את התיבה Support App Home.
בשדה כתובת ה-URL של דף הבית של האפליקציה, מוסיפים כתובת URL. בדרך כלל הערך הזה זהה בתור כתובת ה-URL של האפליקציה. כתובת ה-URL הזו נקראת
APP_HOME
אירועים.לוחצים על שמירה.
דף הבית של האפליקציה ב-Build
כרטיס הבית של האפליקציה מופעל כשמשתמש פותח צ'אט אישי אפשר לעדכן את אפליקציית Chat בתשובה של אירוע אינטראקטיבי, כמו לחיצה על לחצן, שליחת טופס או סגירת תיבת דו-שיח.
בדוגמה הבאה, אפליקציית Chat מציגה כרטיס בית ראשוני של האפליקציה שמציג את השעה שבה נוצר הכרטיס לחצן. כשמשתמש לוחץ על הלחצן, אפליקציית Chat מחזירה כרטיס מעודכן שמציג את השעה שבה נוצר הכרטיס המעודכן.
יצירת הכרטיס הראשוני לדף הבית של האפליקציה
כדי להגדיר את דף הבית של האפליקציה, אפליקציית Chat צריכה לעמוד בדרישות הבאות:
APP_HOME
אירועי אינטראקציה ומחזירים מופע של
RenderActions
עם ניווט pushCard
.
Python
Apps Script
מטמיעים את הפונקציה onAppHome
שמופעלת אחרי כל אירועי APP_HOME
:
בדוגמה הזו, נשלחת הודעה בכרטיס על ידי חזרה כרטיס JSON. אפשר גם להשתמש שירות הכרטיסים של Apps Script.
Node.js
Java
איך לעדכן כרטיס בית של אפליקציה
אם כרטיס הבית של האפליקציה הראשונית מכיל ווידג'טים אינטראקטיביים כמו לחצנים
או אפשרויות קלט שבחרת, אפליקציית Chat צריכה לטפל
את אירועי האינטראקציה הקשורים באמצעות החזרת מופע של
RenderActions
עם ניווט updateCard
. למידע נוסף על טיפול באינטראקטיביות
ווידג'טים,
עיבוד מידע שמשתמשים מזינים.
Python
Apps Script
בדוגמה הזו, נשלחת הודעה בכרטיס על ידי חזרה כרטיס JSON. אפשר גם להשתמש שירות הכרטיסים של Apps Script.
Node.js
Java
מגבלות
באופן כללי,
navigation
הוא
לא זמין לאפליקציות צ'אט. אי אפשר להחזיר ערימה של כרטיסים.
רק pushCard
(לתגובה ראשונית) ו-updateCard
(לעדכונים)
זמין לאפליקציות צ'אט.
נושאים קשורים
- הצגת דוגמאות של אפליקציות ל-Chat בדף הבית של האפליקציות.
כדי לפתוח תיבת דו-שיח, צריך להשתמש באינטראקציה
OPEN_DIALOG
. לקבלת מידע נוסף, לראות פותחים תיבת דו-שיח בתגובה לכרטיס הבית של האפליקציה.כדי לסגור תיבת דו-שיח, אפשר להשתמש באינטראקציה
CLOSE_DIALOG
כדי לסגור אותה. ולחזור לכרטיס הבית של האפליקציה או להשתמש ב-CLOSE_DIALOG_EXECUTE
כדי לסגור את תיבת הדו-שיח ולרענן את כרטיס דף הבית של האפליקציה. עבור מידע נוסף: מענה לתיבת דו-שיח עם הכרטיס הראשי של האפליקציה.דוגמה לאופן השימוש בדף הבית של האפליקציה זמינה במאמר אפליקציית Chat לניהול בעיות ב-Codelab אתם יכולים ליצור אפליקציות ל-Google Chat בעזרת Gemini.