ChoiceFactory.ForChannel(String, IList<Choice>, String, String, ChoiceFactoryOptions) Method

Definition

Creates a message activity that includes a list of choices formatted based on the capabilities of a given channel.

public static Microsoft.Bot.Schema.IMessageActivity ForChannel (string channelId, System.Collections.Generic.IList<Microsoft.Bot.Builder.Dialogs.Choices.Choice> list, string text = default, string speak = default, Microsoft.Bot.Builder.Dialogs.Choices.ChoiceFactoryOptions options = default);
static member ForChannel : string * System.Collections.Generic.IList<Microsoft.Bot.Builder.Dialogs.Choices.Choice> * string * string * Microsoft.Bot.Builder.Dialogs.Choices.ChoiceFactoryOptions -> Microsoft.Bot.Schema.IMessageActivity
Public Shared Function ForChannel (channelId As String, list As IList(Of Choice), Optional text As String = Nothing, Optional speak As String = Nothing, Optional options As ChoiceFactoryOptions = Nothing) As IMessageActivity

Parameters

channelId
String

A channel ID. The Channels class contains known channel IDs.

list
IList<Choice>

The list of choices to include.

text
String

Optional, the text of the message to send.

speak
String

Optional, the text to be spoken by your bot on a speech-enabled channel.

options
ChoiceFactoryOptions

Optional, the formatting options to use when rendering as a list.

Returns

IMessageActivity

The created message activity.

Remarks

The algorithm prefers to format the supplied list of choices as suggested actions but can decide to use a text based list if suggested actions aren't natively supported by the channel, there are too many choices for the channel to display, or the title of any choice is too long.

If the algorithm decides to use a list, for 3 or fewer choices with short titles it will use an inline list; otherwise, a numbered list.

Applies to