MessageFactory Class

Definition

Contains utility methods for various message types a bot can return.

public static class MessageFactory
type MessageFactory = class
Public Class MessageFactory
Inheritance
MessageFactory

Examples

// Create and send a message.
var message = MessageFactory.Text("Hello World");
await context.SendActivity(message);

Remarks

The following apply to message actions in general.

See the channel's documentation for limits imposed upon the contents of the text of the message to send.

To control various characteristics of your bot's speech such as voice, rate, volume, pronunciation, and pitch, specify test to speak in Speech Synthesis Markup Language (SSML) format.

Channels decide how each card action manifests in their user experience. In most cases, the cards are clickable. In others, they may be selected by speech input. In cases where the channel does not offer an interactive activation experience (e.g., when interacting over SMS), the channel may not support activation whatsoever. The decision about how to render actions is controlled by normative requirements elsewhere in this document (e.g. within the card format, or within the suggested actions definition).

Methods

Attachment(Attachment, String, String, String)

Returns a message activity that contains an attachment.

Attachment(IEnumerable<Attachment>, String, String, String)

Returns a message activity that contains a collection of attachments, in a list.

Carousel(IEnumerable<Attachment>, String, String, String)

Returns a message activity that contains a collection of attachments, as a carousel.

ContentUrl(String, String, String, String, String, String)

Returns a message activity that contains a single image or video.

SuggestedActions(IEnumerable<CardAction>, String, String, String)

Returns a message that includes a set of suggested actions and optional text.

SuggestedActions(IEnumerable<String>, String, String, String)

Returns a message that includes a set of suggested actions and optional text.

Text(String, String, String)

Returns a simple text message.

Applies to