MembersAddedRouteAttribute Class

Definition

Attribute to define a route that handles conversation update activities when members are added.

[System.AttributeUsage(System.AttributeTargets.Method, Inherited=true)]
public class MembersAddedRouteAttribute : Attribute, Microsoft.Agents.Builder.App.IRouteAttribute
[<System.AttributeUsage(System.AttributeTargets.Method, Inherited=true)>]
type MembersAddedRouteAttribute = class
    inherit Attribute
    interface IRouteAttribute
Public Class MembersAddedRouteAttribute
Inherits Attribute
Implements IRouteAttribute
Inheritance
MembersAddedRouteAttribute
Attributes
Implements

Remarks

Decorate a method with this attribute to register it as a handler for the MembersAdded event. The method must match the RouteHandler delegate signature.

[MembersAddedRoute]
public async Task OnMembersAddedAsync(ITurnContext 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
MembersAddedRouteAttribute(Boolean, UInt16, String)

Attribute to define a route that handles conversation update activities when members are added.

Methods

Name Description
AddRoute(AgentApplication, MethodInfo)

Applies to