MessageFactory Classe
- java.
lang. Object - com.
microsoft. bot. builder. MessageFactory
- com.
public final class MessageFactory
Contiene metodi di utilità per vari tipi di messaggio che un bot può restituire.
Creare e inviare un messaggio. Activity message = MessageFactory.text("Hello World"); conext.sendActivity(message);
Il codice seguente si applica alle azioni del messaggio in generale. Vedere la documentazione del canale per i limiti imposti al contenuto del testo del messaggio da inviare.
Per controllare varie caratteristiche del parlato del bot, ad esempio voce, frequenza, volume, pronuncia e passo, specificare il test per parlare in formato SSML (Speech Synthesis Markup Language).
I canali decidono il modo in cui ogni azione della scheda si manifesta nell'esperienza utente. Nella maggior parte dei casi, le schede sono selezionabili. In altri, possono essere selezionati dall'input vocale. Nei casi in cui il canale non offre un'esperienza di attivazione interattiva (ad esempio, durante l'interazione tramite SMS), il canale potrebbe non supportare l'attivazione. La decisione su come eseguire il rendering delle azioni è controllata da requisiti normativi altrove in questo documento (ad esempio, all'interno del formato della scheda o all'interno della definizione delle azioni suggerite).
Riepilogo dei metodi
| Modificatore e tipo | Metodo e descrizione |
|---|---|
| static Activity |
attachment(Attachment attachment)
Restituisce un'attività di messaggio che contiene un allegato. |
| static Activity |
attachment(Attachment attachment, String text)
Restituisce un'attività di messaggio che contiene un allegato. |
| static Activity |
attachment(Attachment attachment, String text, String ssml, InputHints inputHint)
Restituisce un'attività di messaggio che contiene un allegato. |
| static Activity |
attachment(List<Attachment> attachments)
Restituisce un'attività di messaggio che contiene un allegato. |
| static Activity |
attachment(List<Attachment> attachments, String text, String ssml, InputHints inputHint)
Restituisce un'attività di messaggio che contiene un allegato. |
| static Activity |
carousel(List<Attachment> attachments, String text)
Restituisce un'attività di messaggio che contiene una raccolta di allegati, in un elenco. |
| static Activity |
carousel(List<Attachment> attachments, String text, String ssml, InputHints inputHint)
Restituisce un'attività di messaggio che contiene una raccolta di allegati, in un elenco. |
| static Activity |
contentUrl(String url, String contentType)
Restituisce un'attività di messaggio che contiene una singola immagine o video. |
| static Activity |
contentUrl(String url, String contentType, String name, String text, String ssml, InputHints inputHint)
Restituisce un'attività di messaggio che contiene una singola immagine o video. |
| static Activity |
suggestedActions(List<String> actions, String text)
Restituisce un messaggio che include un set di azioni suggerite e testo facoltativo. |
| static Activity |
suggestedActions(List<String> actions, String text, String ssml, InputHints inputHint)
Restituisce un messaggio che include un set di azioni suggerite e testo facoltativo. |
| static Activity |
suggestedCardActions(List<CardAction> actions, String text)
Restituisce un messaggio che include un set di azioni suggerite e testo facoltativo. |
| static Activity |
suggestedCardActions(List<CardAction> actions, String text, String ssml, InputHints inputHint)
Restituisce un messaggio che include un set di azioni suggerite e testo facoltativo. |
| static Activity |
text(String text)
Restituisce un semplice messaggio di testo. |
| static Activity |
text(String text, String ssml, InputHints inputHint)
Restituisce un semplice messaggio di testo. |
Metodi ereditati da java.lang.Object
Dettagli metodo
attachment
public static Activity attachment(Attachment attachment)
Restituisce un'attività di messaggio che contiene un allegato.
Parametri:
Restituisce:
attachment
public static Activity attachment(Attachment attachment, String text)
Restituisce un'attività di messaggio che contiene un allegato.
Parametri:
Restituisce:
attachment
public static Activity attachment(Attachment attachment, String text, String ssml, InputHints inputHint)
Restituisce un'attività di messaggio che contiene un allegato.
Parametri:
Restituisce:
attachment
public static Activity attachment(List
Restituisce un'attività di messaggio che contiene un allegato.
Parametri:
Restituisce:
attachment
public static Activity attachment(List
Restituisce un'attività di messaggio che contiene un allegato.
Parametri:
Restituisce:
carousel
public static Activity carousel(List
Restituisce un'attività di messaggio che contiene una raccolta di allegati, in un elenco.
Parametri:
Restituisce:
carousel
public static Activity carousel(List
Restituisce un'attività di messaggio che contiene una raccolta di allegati, in un elenco.
Parametri:
Restituisce:
contentUrl
public static Activity contentUrl(String url, String contentType)
Restituisce un'attività di messaggio che contiene una singola immagine o video.
Parametri:
Restituisce:
contentUrl
public static Activity contentUrl(String url, String contentType, String name, String text, String ssml, InputHints inputHint)
Restituisce un'attività di messaggio che contiene una singola immagine o video.
Parametri:
Restituisce:
suggestedActions
public static Activity suggestedActions(List
Restituisce un messaggio che include un set di azioni suggerite e testo facoltativo. // Create the activity and add suggested actions. Activity activity = MessageFactory.suggestedActions( new String[] { "red", "green", "blue" }, "Choose a color");
// Send the activity as a reply to the user. context.sendActivity(activity);
Parametri:
Restituisce:
suggestedActions
public static Activity suggestedActions(List
Restituisce un messaggio che include un set di azioni suggerite e testo facoltativo. // Create the activity and add suggested actions. Activity activity = MessageFactory.suggestedActions( new String[] { "red", "green", "blue" }, "Choose a color");
// Send the activity as a reply to the user. context.sendActivity(activity);
Parametri:
Restituisce:
suggestedCardActions
public static Activity suggestedCardActions(List
Restituisce un messaggio che include un set di azioni suggerite e testo facoltativo.
Parametri:
Restituisce:
suggestedCardActions
public static Activity suggestedCardActions(List
Restituisce un messaggio che include un set di azioni suggerite e testo facoltativo.
Parametri:
Restituisce:
text
public static Activity text(String text)
Restituisce un semplice messaggio di testo.
Parametri:
Restituisce:
text
public static Activity text(String text, String ssml, InputHints inputHint)
Restituisce un semplice messaggio di testo.
Parametri:
Restituisce: