AgentApplication.OnMessage Method

Definition

Overloads

OnMessage(MultipleRouteSelector, RouteHandler, UInt16, String[])

Handles incoming messages with a given keyword.
This method provides a simple way to have a Agent respond anytime a user sends a message with a specific word or phrase.

OnMessage(RouteSelector, RouteHandler, UInt16, String[])

Handles incoming messages with a given keyword.
This method provides a simple way to have a Agent respond anytime a user sends a message with a specific word or phrase.

OnMessage(String, RouteHandler, UInt16, String[])

Handles incoming messages with a given keyword.
This method provides a simple way to have an Agent respond anytime a user sends a message with a specific word or phrase.
For example, you can easily clear the current conversation anytime a user sends "/reset":
application.OnMessage("/reset", (context, turnState, _) => ...);

OnMessage(Regex, RouteHandler, UInt16, String[])

Handles incoming messages with a given keyword.
This method provides a simple way to have a Agent respond anytime a user sends a message with a specific word or phrase.
For example, you can easily clear the current conversation anytime a user sends "/reset":
application.OnMessage(new Regex("reset"), (context, turnState, _) => ...);

OnMessage(MultipleRouteSelector, RouteHandler, UInt16, String[])

Handles incoming messages with a given keyword.
This method provides a simple way to have a Agent respond anytime a user sends a message with a specific word or phrase.

public Microsoft.Agents.Builder.App.AgentApplication OnMessage(Microsoft.Agents.Builder.App.MultipleRouteSelector routeSelectors, Microsoft.Agents.Builder.App.RouteHandler handler, ushort rank = 32767, string[] autoSignInHandlers = default);
member this.OnMessage : Microsoft.Agents.Builder.App.MultipleRouteSelector * Microsoft.Agents.Builder.App.RouteHandler * uint16 * string[] -> Microsoft.Agents.Builder.App.AgentApplication
Public Function OnMessage (routeSelectors As MultipleRouteSelector, handler As RouteHandler, Optional rank As UShort = 32767, Optional autoSignInHandlers As String() = Nothing) As AgentApplication

Parameters

routeSelectors
MultipleRouteSelector

Combination of String, Regex, and RouteSelector selectors.

handler
RouteHandler

Function to call when the route is triggered.

rank
UInt16

0 - ushort.MaxValue for order of evaluation. Ranks of the same value are evaluated in order of addition.

autoSignInHandlers
String[]

Returns

The application instance for chaining purposes.

Applies to

OnMessage(RouteSelector, RouteHandler, UInt16, String[])

Handles incoming messages with a given keyword.
This method provides a simple way to have a Agent respond anytime a user sends a message with a specific word or phrase.

public Microsoft.Agents.Builder.App.AgentApplication OnMessage(Microsoft.Agents.Builder.App.RouteSelector routeSelector, Microsoft.Agents.Builder.App.RouteHandler handler, ushort rank = 32767, string[] autoSignInHandlers = default);
member this.OnMessage : Microsoft.Agents.Builder.App.RouteSelector * Microsoft.Agents.Builder.App.RouteHandler * uint16 * string[] -> Microsoft.Agents.Builder.App.AgentApplication
Public Function OnMessage (routeSelector As RouteSelector, handler As RouteHandler, Optional rank As UShort = 32767, Optional autoSignInHandlers As String() = Nothing) As AgentApplication

Parameters

routeSelector
RouteSelector

Function that's used to select a route. The function returning true triggers the route.

handler
RouteHandler

Function to call when the route is triggered.

rank
UInt16

0 - ushort.MaxValue for order of evaluation. Ranks of the same value are evaluated in order of addition.

autoSignInHandlers
String[]

Returns

The application instance for chaining purposes.

Applies to

OnMessage(String, RouteHandler, UInt16, String[])

Handles incoming messages with a given keyword.
This method provides a simple way to have an Agent respond anytime a user sends a message with a specific word or phrase.
For example, you can easily clear the current conversation anytime a user sends "/reset":
application.OnMessage("/reset", (context, turnState, _) => ...);

public Microsoft.Agents.Builder.App.AgentApplication OnMessage(string text, Microsoft.Agents.Builder.App.RouteHandler handler, ushort rank = 32767, string[] autoSignInHandlers = default);
member this.OnMessage : string * Microsoft.Agents.Builder.App.RouteHandler * uint16 * string[] -> Microsoft.Agents.Builder.App.AgentApplication
Public Function OnMessage (text As String, handler As RouteHandler, Optional rank As UShort = 32767, Optional autoSignInHandlers As String() = Nothing) As AgentApplication

Parameters

text
String

Substring of the incoming message text.

handler
RouteHandler

Function to call when the route is triggered.

rank
UInt16

0 - ushort.MaxValue for order of evaluation. Ranks of the same value are evaluated in order of addition.

autoSignInHandlers
String[]

Returns

The application instance for chaining purposes.

Applies to

OnMessage(Regex, RouteHandler, UInt16, String[])

Handles incoming messages with a given keyword.
This method provides a simple way to have a Agent respond anytime a user sends a message with a specific word or phrase.
For example, you can easily clear the current conversation anytime a user sends "/reset":
application.OnMessage(new Regex("reset"), (context, turnState, _) => ...);

public Microsoft.Agents.Builder.App.AgentApplication OnMessage(System.Text.RegularExpressions.Regex textPattern, Microsoft.Agents.Builder.App.RouteHandler handler, ushort rank = 32767, string[] autoSignInHandlers = default);
member this.OnMessage : System.Text.RegularExpressions.Regex * Microsoft.Agents.Builder.App.RouteHandler * uint16 * string[] -> Microsoft.Agents.Builder.App.AgentApplication
Public Function OnMessage (textPattern As Regex, handler As RouteHandler, Optional rank As UShort = 32767, Optional autoSignInHandlers As String() = Nothing) As AgentApplication

Parameters

textPattern
Regex

Regular expression to match against the text of an incoming message.

handler
RouteHandler

Function to call when the route is triggered.

rank
UInt16

0 - ushort.MaxValue for order of evaluation. Ranks of the same value are evaluated in order of addition.

autoSignInHandlers
String[]

Returns

The application instance for chaining purposes.

Applies to