Language

SlackAgentExtension Class

Definition

Provides Slack-specific extensions for an agent application, enabling message and event routing, Slack API calls, and stream management for the Slack channel.

public class SlackAgentExtension : Microsoft.Agents.Builder.AgentExtension
type SlackAgentExtension = class
    inherit AgentExtension
Public Class SlackAgentExtension
Inherits AgentExtension
Inheritance
SlackAgentExtension

Remarks

Use this extension to integrate Slack channel support into an agent application. It offers methods to register message and event handlers that are scoped to Slack, as well as utilities for interacting with the Slack API and managing Slack conversation streams. All routes and handlers registered through this extension are limited to activities originating from the Slack channel.

The preferred way to enable the Slack extension is via the SlackExtensionAttribute on a partialAgentApplication subclass, which causes a source generator to expose a SlackExtension property of this type automatically. Use this constructor directly only when manually registering the extension with AgentApplication.

Constructors

Name Description
SlackAgentExtension(AgentApplication)

Properties

Name Description
ChannelId (Inherited from AgentExtension)

Methods

Name Description
AddRoute(AgentApplication, Route) (Inherited from AgentExtension)
AddRoute(AgentApplication, RouteSelector, RouteHandler, Boolean, Boolean, UInt16, String[]) (Inherited from AgentExtension)
AddRoute(AgentApplication, RouteSelector, RouteHandler, Boolean, UInt16, String[])
Obsolete.
(Inherited from AgentExtension)
CallAsync(ITurnContext, String, Object, String, CancellationToken)

Invokes a Slack Web API method asynchronously using the specified context and parameters.

CreateStreamAsync(ITurnContext, String)

Creates and starts a new Slack stream for the specified conversation or thread.

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

Registers an event route that triggers the specified handler when an incoming Slack event matches the given name pattern.

OnEvent(SlackRouteHandler, String[], UInt16)

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

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

Registers an event route that triggers the specified handler when an incoming Slack event matches the given name.

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.

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

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

Applies to