Questa pagina spiega come creare una home page per App Google Chat. La home page dell'app è un'interfaccia di carte personalizzabile che un'app di Chat invia a un utente quando apre una pagina con l'app Chat.
Ad esempio, puoi configurare il messaggio della scheda Home dell'app in modo che includa suggerimenti per l'interazione con App di chat con comandi slash. Per gli utenti finali, la home page dell'app disponibile nel messaggio diretto di un'app di Chat solo se lo sviluppatore di app attiva la funzionalità.
Utilizza Card Builder per progettare e visualizzare l'anteprima di messaggi delle schede JSON per le app di chat:
Apri il generatore di schedePrerequisiti
Python
Un'app di Google Chat abilitata per le funzionalità interattive. Per creare un un'app di chat interattiva utilizzando un servizio HTTP, completa questa guida rapida.
Apps Script
Un'app di Google Chat abilitata per le funzionalità interattive. Per creare un app di Chat interattiva in Apps Script, completa questa guida rapida.
Node.js
Un'app di Google Chat abilitata per le funzionalità interattive. Per creare un un'app di chat interattiva utilizzando un servizio HTTP, completa questa guida rapida.
Java
Un'app di Google Chat abilitata per le funzionalità interattive. Per creare un un'app di chat interattiva utilizzando un servizio HTTP, completa questa guida rapida.
Configura l'API Chat
Per supportare la home page dell'app, devi aggiornare la configurazione dell'API Chat nella console Google Cloud.
Python
Nella console Google Cloud, vai a Menu > Altri prodotti > Google Workspace > Libreria prodotti > API Google Chat.
Fai clic su Gestisci, quindi sulla scheda Configurazione.
Seleziona la casella di controllo Support App Home.
Aggiungi un URL nel campo URL della home page dell'app. Questo valore è solitamente lo stesso URL come URL dell'app. Questo URL viene chiamato
APP_HOME
eventi.Fai clic su Salva.
Apps Script
Nella console Google Cloud, vai a Menu > Altri prodotti > Google Workspace > Libreria prodotti > API Google Chat.
Fai clic su Gestisci, quindi sulla scheda Configurazione.
Seleziona la casella di controllo Support App Home.
Fai clic su Salva.
Node.js
Nella console Google Cloud, vai a Menu > Altri prodotti > Google Workspace > Libreria prodotti > API Google Chat.
Fai clic su Gestisci, quindi sulla scheda Configurazione.
Seleziona la casella di controllo Support App Home.
Aggiungi un URL nel campo URL della home page dell'app. Questo valore è solitamente lo stesso URL come URL dell'app. Questo URL viene chiamato
APP_HOME
eventi.Fai clic su Salva.
Java
Nella console Google Cloud, vai a Menu > Altri prodotti > Google Workspace > Libreria prodotti > API Google Chat.
Fai clic su Gestisci, quindi sulla scheda Configurazione.
Seleziona la casella di controllo Support App Home.
Aggiungi un URL nel campo URL della home page dell'app. Questo valore è solitamente lo stesso URL come URL dell'app. Questo URL viene chiamato
APP_HOME
eventi.Fai clic su Salva.
Home page di Build app
La scheda della home page dell'app viene avviata quando un utente apre un messaggio diretto dalla app di chat e può essere aggiornata in risposta Un evento interattivo come un clic su un pulsante, l'invio di un modulo o la chiusura di una finestra di dialogo.
Nell'esempio seguente, l'app Chat mostra una scheda iniziale della home page dell'app che mostra l'ora in cui è stata creata e un pulsante. Quando un utente fa clic sul pulsante, l'app Chat restituisce una scheda aggiornata che mostra l'ora in cui è stata creata.
Crea la carta iniziale per la home page dell'app
Per creare la home page dell'app, l'app Chat deve gestire
APP_HOME
eventi di interazione e restituiscono un'istanza di
RenderActions
con navigazione pushCard
.
Python
Apps Script
Implementa la funzione onAppHome
che viene richiamata dopo tutti gli eventi APP_HOME
:
Questo esempio invia un messaggio di una scheda restituendo JSON card. Puoi utilizzare anche Servizio di schede Apps Script.
Node.js
Java
Aggiorna la scheda Home dell'app
Se la scheda iniziale dell'app iniziale contiene widget interattivi, ad esempio pulsanti
o input di selezione, l'app Chat deve gestire
gli eventi di interazione correlati restituendo un'istanza
RenderActions
con navigazione updateCard
. Per scoprire di più sulla gestione delle richieste interattive,
widget, vedi
Elabora le informazioni inserite dagli utenti.
Python
Apps Script
Questo esempio invia un messaggio di una scheda restituendo JSON card. Puoi utilizzare anche Servizio di schede Apps Script.
Node.js
Java
Limitazioni
In generale,
navigation
è
non è disponibile per le app di chat. Non puoi restituire una pila di carte.
Solo pushCard
(per la risposta iniziale) e updateCard
(per gli aggiornamenti) sono
disponibile per le app di chat.
Argomenti correlati
- Visualizza esempi di app di Chat che utilizzano la home page dell'app.
Per aprire una finestra di dialogo, utilizza l'interazione di
OPEN_DIALOG
. Per ulteriori informazioni, vedi Apri una finestra di dialogo in risposta alla scheda della home page dell'app.Per chiudere una finestra di dialogo, utilizza l'interazione
CLOSE_DIALOG
per chiudere la finestra di dialogo e torna alla home page dell'app o usaCLOSE_DIALOG_EXECUTE
Interazione per chiudere la finestra di dialogo e aggiornare la scheda della home page dell'app. Per ulteriori informazioni, vedi Rispondere a una finestra di dialogo per la scheda della home page dell'app.Per un esempio di come usare l'app Home, vedi le app Chat per la gestione dei problemi nel codelab Creare app per Google Chat con Gemini.