Language

SlackAgentExtension.OnMessage Method

Definition

Overloads

Name Description
OnMessage(SlackRouteHandler, String[], UInt16)

Registers a message route handler for any Slack message received by the agent.

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

Registers a message route that triggers the specified handler when an incoming Slack message matches the given text.

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

Registers a message route that triggers the specified handler when an incoming Slack message matches the given text pattern.

OnMessage(SlackRouteHandler, String[], UInt16)

Registers a message route handler for any Slack message received by the agent.

public Microsoft.Agents.Extensions.Slack.SlackAgentExtension OnMessage(Microsoft.Agents.Extensions.Slack.SlackRouteHandler routeHandler, string[] autoSigninHandlers = default, ushort rank = 32767);
member this.OnMessage : Microsoft.Agents.Extensions.Slack.SlackRouteHandler * string[] * uint16 -> Microsoft.Agents.Extensions.Slack.SlackAgentExtension
Public Function OnMessage (routeHandler As SlackRouteHandler, Optional autoSigninHandlers As String() = Nothing, Optional rank As UShort = 32767) As SlackAgentExtension

Parameters

routeHandler
SlackRouteHandler

The delegate that processes incoming Slack message activities. This handler will be invoked when a message activity is received on the Slack channel.

autoSigninHandlers
String[]

An optional array of handler names that support automatic sign-in. If specified, these handlers will be used to facilitate OAuth flows for the route.

rank
UInt16

The order rank that determines the priority of the route. Use RouteRank.Unspecified to assign the default rank.

Returns

The current instance of SlackAgentExtension to allow method chaining.

Applies to

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

Registers a message route that triggers the specified handler when an incoming Slack message matches the given text.

public Microsoft.Agents.Extensions.Slack.SlackAgentExtension OnMessage(string text, Microsoft.Agents.Extensions.Slack.SlackRouteHandler routeHandler, string[] autoSigninHandlers = default, ushort rank = 32767);
member this.OnMessage : string * Microsoft.Agents.Extensions.Slack.SlackRouteHandler * string[] * uint16 -> Microsoft.Agents.Extensions.Slack.SlackAgentExtension
Public Function OnMessage (text As String, routeHandler As SlackRouteHandler, Optional autoSigninHandlers As String() = Nothing, Optional rank As UShort = 32767) As SlackAgentExtension

Parameters

text
String

The text pattern to match incoming Slack messages. The route is triggered when a message matches this text.

routeHandler
SlackRouteHandler

The handler to invoke when the route is matched. Responsible for processing the incoming message.

autoSigninHandlers
String[]

An optional array of OAuth handler names to use for automatic sign-in. If null, no auto sign-in handlers are applied.

rank
UInt16

The rank that determines the order in which this route is evaluated. Use RouteRank.Unspecified for default ordering.

Returns

The current instance of SlackAgentExtension to allow method chaining.

Remarks

This differs from AgentApplication.OnMessage in that this only matches for the slack channel.

Applies to

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

Registers a message route that triggers the specified handler when an incoming Slack message matches the given text pattern.

public Microsoft.Agents.Extensions.Slack.SlackAgentExtension OnMessage(System.Text.RegularExpressions.Regex textPattern, Microsoft.Agents.Extensions.Slack.SlackRouteHandler routeHandler, string[] autoSigninHandlers = default, ushort rank = 32767);
member this.OnMessage : System.Text.RegularExpressions.Regex * Microsoft.Agents.Extensions.Slack.SlackRouteHandler * string[] * uint16 -> Microsoft.Agents.Extensions.Slack.SlackAgentExtension
Public Function OnMessage (textPattern As Regex, routeHandler As SlackRouteHandler, Optional autoSigninHandlers As String() = Nothing, Optional rank As UShort = 32767) As SlackAgentExtension

Parameters

textPattern
Regex

A regular expression used to match the text of incoming Slack messages. The route is triggered when the message text matches this pattern.

routeHandler
SlackRouteHandler

The handler to invoke when the route is matched. This delegate processes the incoming message.

autoSigninHandlers
String[]

An optional array of OAuth handler names to use for automatic sign-in if authentication is required. May be null if no auto sign-in is needed.

rank
UInt16

The rank that determines the order in which this route is evaluated relative to other routes. Lower values indicate higher priority. The default is RouteRank.Unspecified.

Returns

The current instance of SlackAgentExtension to allow method chaining.

Remarks

This differs from AgentApplication.OnMessage in that this only matches for the slack channel.

Applies to