Share via


MessageFactory class

A factory class for creating various types of message activities.

Methods

attachment(Attachment, string, string, string)

Creates a message activity with a single attachment.

carousel(Attachment[], string, string, string)

Creates a message activity with a carousel of attachments.

contentUrl(string, string, string, string, string, string)

Creates a message activity with content from a URL.

list(Attachment[], string, string, string)

Creates a message activity with a list of attachments.

suggestedActions((string | CardAction)[], string, string, string)

Creates a message activity with suggested actions.

text(string, string, string)

Creates a text message activity.

Method Details

attachment(Attachment, string, string, string)

Creates a message activity with a single attachment.

static function attachment(attachment: Attachment, text?: string, speak?: string, inputHint?: string): Activity

Parameters

attachment
Attachment

The attachment to include in the message.

text

string

(Optional) The text of the message.

speak

string

(Optional) The text to be spoken by the agent.

inputHint

string

(Optional) The input hint for the message.

Returns

The created message activity with an attachment.

Creates a message activity with a carousel of attachments.

static function carousel(attachments: Attachment[], text?: string, speak?: string, inputHint?: string): Activity

Parameters

attachments

Attachment[]

The list of attachments to include in the carousel.

text

string

(Optional) The text of the message.

speak

string

(Optional) The text to be spoken by the agent.

inputHint

string

(Optional) The input hint for the message.

Returns

The created message activity with a carousel of attachments.

contentUrl(string, string, string, string, string, string)

Creates a message activity with content from a URL.

static function contentUrl(url: string, contentType: string, name?: string, text?: string, speak?: string, inputHint?: string): Activity

Parameters

url

string

The URL of the content.

contentType

string

The content type of the attachment.

name

string

(Optional) The name of the attachment.

text

string

(Optional) The text of the message.

speak

string

(Optional) The text to be spoken by the agent.

inputHint

string

(Optional) The input hint for the message.

Returns

The created message activity with content from a URL.

list(Attachment[], string, string, string)

Creates a message activity with a list of attachments.

static function list(attachments: Attachment[], text?: string, speak?: string, inputHint?: string): Activity

Parameters

attachments

Attachment[]

The list of attachments to include in the message.

text

string

(Optional) The text of the message.

speak

string

(Optional) The text to be spoken by the agent.

inputHint

string

(Optional) The input hint for the message.

Returns

The created message activity with a list of attachments.

suggestedActions((string | CardAction)[], string, string, string)

Creates a message activity with suggested actions.

static function suggestedActions(actions: (string | CardAction)[], text?: string, speak?: string, inputHint?: string): Activity

Parameters

actions

(string | CardAction)[]

The suggested actions.

text

string

(Optional) The text of the message.

speak

string

(Optional) The text to be spoken by the agent.

inputHint

string

(Optional) The input hint for the message.

Returns

The created message activity with suggested actions.

text(string, string, string)

Creates a text message activity.

static function text(text: string, speak?: string, inputHint?: string): Activity

Parameters

text

string

The text of the message.

speak

string

(Optional) The text to be spoken by the agent.

inputHint

string

(Optional) The input hint for the message.

Returns

The created text message activity.