MessageFactory.SuggestedActions Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
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. |
SuggestedActions(IEnumerable<CardAction>, String, String, String, IList<String>) |
Returns a message that includes a set of suggested actions and optional text. |
SuggestedActions(IEnumerable<String>, String, String, String, IList<String>) |
Returns a message that includes a set of suggested actions and optional text. |
SuggestedActions(IEnumerable<CardAction>, String, String, String)
Returns a message that includes a set of suggested actions and optional text.
public static Microsoft.Bot.Schema.IMessageActivity SuggestedActions (System.Collections.Generic.IEnumerable<Microsoft.Bot.Schema.CardAction> cardActions, string text = default, string ssml = default, string inputHint = default);
static member SuggestedActions : seq<Microsoft.Bot.Schema.CardAction> * string * string * string -> Microsoft.Bot.Schema.IMessageActivity
Public Shared Function SuggestedActions (cardActions As IEnumerable(Of CardAction), Optional text As String = Nothing, Optional ssml As String = Nothing, Optional inputHint As String = Nothing) As IMessageActivity
Parameters
- cardActions
- IEnumerable<CardAction>
The card actions to include.
- text
- String
Optional, the text of the message to send.
- ssml
- String
Optional, text to be spoken by your bot on a speech-enabled channel.
- inputHint
- String
Optional, indicates whether your bot is accepting, expecting, or ignoring user input after the message is delivered to the client. One of: "acceptingInput", "ignoringInput", or "expectingInput". Default is "acceptingInput".
Returns
A message activity that contains the suggested actions.
Exceptions
cardActions
is null
.
Examples
// Create the activity and add suggested actions.
var activity = MessageFactory.SuggestedActions(
new CardAction[]
{
new CardAction(title: "red", type: ActionTypes.ImBack, value: "red"),
new CardAction( title: "green", type: ActionTypes.ImBack, value: "green"),
new CardAction(title: "blue", type: ActionTypes.ImBack, value: "blue")
}, text: "Choose a color");
// Send the activity as a reply to the user.
await context.SendActivity(activity);
See also
Applies to
SuggestedActions(IEnumerable<String>, String, String, String)
Returns a message that includes a set of suggested actions and optional text.
public static Microsoft.Bot.Schema.IMessageActivity SuggestedActions (System.Collections.Generic.IEnumerable<string> actions, string text = default, string ssml = default, string inputHint = default);
static member SuggestedActions : seq<string> * string * string * string -> Microsoft.Bot.Schema.IMessageActivity
Public Shared Function SuggestedActions (actions As IEnumerable(Of String), Optional text As String = Nothing, Optional ssml As String = Nothing, Optional inputHint As String = Nothing) As IMessageActivity
Parameters
- actions
- IEnumerable<String>
The text of the actions to create.
- text
- String
The text of the message to send.
- ssml
- String
Optional, text to be spoken by your bot on a speech-enabled channel.
- inputHint
- String
Optional, indicates whether your bot is accepting, expecting, or ignoring user input after the message is delivered to the client. One of: "acceptingInput", "ignoringInput", or "expectingInput". Default is "acceptingInput".
Returns
A message activity containing the suggested actions.
Exceptions
actions
is null
.
Examples
// Create the activity and add suggested actions.
var activity = MessageFactory.SuggestedActions(
new string[] { "red", "green", "blue" },
text: "Choose a color");
// Send the activity as a reply to the user.
await context.SendActivity(activity);
Remarks
This method creates a suggested action for each string in actions
. The created action uses the text for the Value and Title and sets the Type to ImBack.
See also
Applies to
SuggestedActions(IEnumerable<CardAction>, String, String, String, IList<String>)
Returns a message that includes a set of suggested actions and optional text.
public static Microsoft.Bot.Schema.IMessageActivity SuggestedActions (System.Collections.Generic.IEnumerable<Microsoft.Bot.Schema.CardAction> cardActions, string text = default, string ssml = default, string inputHint = default, System.Collections.Generic.IList<string> toList = default);
static member SuggestedActions : seq<Microsoft.Bot.Schema.CardAction> * string * string * string * System.Collections.Generic.IList<string> -> Microsoft.Bot.Schema.IMessageActivity
Public Shared Function SuggestedActions (cardActions As IEnumerable(Of CardAction), Optional text As String = Nothing, Optional ssml As String = Nothing, Optional inputHint As String = Nothing, Optional toList As IList(Of String) = Nothing) As IMessageActivity
Parameters
- cardActions
- IEnumerable<CardAction>
The card actions to include.
- text
- String
Optional, the text of the message to send.
- ssml
- String
Optional, text to be spoken by your bot on a speech-enabled channel.
- inputHint
- String
Optional, indicates whether your bot is accepting, expecting, or ignoring user input after the message is delivered to the client. One of: "acceptingInput", "ignoringInput", or "expectingInput". Default is "acceptingInput".
Returns
A message activity that contains the suggested actions.
Exceptions
cardActions
is null
.
Examples
// Create the activity and add suggested actions.
var activity = MessageFactory.SuggestedActions(
new CardAction[]
{
new CardAction(title: "red", type: ActionTypes.ImBack, value: "red"),
new CardAction( title: "green", type: ActionTypes.ImBack, value: "green"),
new CardAction(title: "blue", type: ActionTypes.ImBack, value: "blue")
}, text: "Choose a color");
// Send the activity as a reply to the user.
await context.SendActivity(activity);
Applies to
SuggestedActions(IEnumerable<String>, String, String, String, IList<String>)
Returns a message that includes a set of suggested actions and optional text.
public static Microsoft.Bot.Schema.IMessageActivity SuggestedActions (System.Collections.Generic.IEnumerable<string> actions, string text = default, string ssml = default, string inputHint = default, System.Collections.Generic.IList<string> toList = default);
static member SuggestedActions : seq<string> * string * string * string * System.Collections.Generic.IList<string> -> Microsoft.Bot.Schema.IMessageActivity
Public Shared Function SuggestedActions (actions As IEnumerable(Of String), Optional text As String = Nothing, Optional ssml As String = Nothing, Optional inputHint As String = Nothing, Optional toList As IList(Of String) = Nothing) As IMessageActivity
Parameters
- actions
- IEnumerable<String>
The text of the actions to create.
- text
- String
The text of the message to send.
- ssml
- String
Optional, text to be spoken by your bot on a speech-enabled channel.
- inputHint
- String
Optional, indicates whether your bot is accepting, expecting, or ignoring user input after the message is delivered to the client. One of: "acceptingInput", "ignoringInput", or "expectingInput". Default is "acceptingInput".
Returns
A message activity containing the suggested actions.
Exceptions
actions
is null
.
Examples
// Create the activity and add suggested actions.
var activity = MessageFactory.SuggestedActions(
new string[] { "red", "green", "blue" },
text: "Choose a color");
// Send the activity as a reply to the user.
await context.SendActivity(activity);
Remarks
This method creates a suggested action for each string in actions
. The created action uses the text for the Value and Title and sets the Type to ImBack.