SlackMembersAddedRouteAttribute Class
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.
Attribute to define a route that handles conversation update activities when members are added.
[Microsoft.Agents.Builder.App.RouteHandlerType(typeof(Microsoft.Agents.Extensions.Slack.SlackRouteHandler))]
[Microsoft.Agents.Builder.App.RouteHandlerType(typeof(Microsoft.Agents.Builder.App.RouteHandler))]
[Microsoft.Agents.Builder.App.RouteHandlerType(typeof(Microsoft.Agents.Builder.App.TypedRouteHandler<Microsoft.Agents.Extensions.Slack.ISlackActivity>))]
[System.AttributeUsage(System.AttributeTargets.Method, Inherited=true)]
public class SlackMembersAddedRouteAttribute : Attribute, Microsoft.Agents.Builder.App.IRouteAttribute
[<Microsoft.Agents.Builder.App.RouteHandlerType(typeof(Microsoft.Agents.Extensions.Slack.SlackRouteHandler))>]
[<Microsoft.Agents.Builder.App.RouteHandlerType(typeof(Microsoft.Agents.Builder.App.RouteHandler))>]
[<Microsoft.Agents.Builder.App.RouteHandlerType(typeof(Microsoft.Agents.Builder.App.TypedRouteHandler<Microsoft.Agents.Extensions.Slack.ISlackActivity>))>]
[<System.AttributeUsage(System.AttributeTargets.Method, Inherited=true)>]
type SlackMembersAddedRouteAttribute = class
inherit Attribute
interface IRouteAttribute
Public Class SlackMembersAddedRouteAttribute
Inherits Attribute
Implements IRouteAttribute
- Inheritance
-
SlackMembersAddedRouteAttribute
- Attributes
- Implements
Remarks
Decorate a method with this attribute to register it as a handler for the MembersAdded event. The method must match the SlackRouteHandler, RouteHandler, or TypedRouteHandler<T> of ISlackActivity delegate signature.
[SlackMembersAddedRoute]
public async Task OnMembersAddedAsync(ISlackTurnContext turnContext, ITurnState turnState, CancellationToken cancellationToken)
{
foreach (ChannelAccount member in turnContext.Activity.MembersAdded)
{
if (member.Id != turnContext.Activity.Recipient.Id)
{
await turnContext.SendActivityAsync(MessageFactory.Text("Hello and Welcome!"), cancellationToken);
}
}
}
Constructors
| Name | Description |
|---|---|
| SlackMembersAddedRouteAttribute(Boolean, UInt16, String) |
Attribute to define a route that handles conversation update activities when members are added. |
Methods
| Name | Description |
|---|---|
| AddRoute(AgentApplication, MethodInfo) | |