teams

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Activity

type Activity struct {
	Type             string           `json:"type"`
	ID               string           `json:"id,omitempty"`
	Timestamp        string           `json:"timestamp,omitempty"`
	ChannelID        string           `json:"channelId,omitempty"`
	ServiceURL       string           `json:"serviceUrl,omitempty"`
	From             ChannelAccount   `json:"from,omitempty"`
	Conversation     ConversationInfo `json:"conversation,omitempty"`
	Recipient        ChannelAccount   `json:"recipient,omitempty"`
	Text             string           `json:"text,omitempty"`
	Entities         []Entity         `json:"entities,omitempty"`
	ChannelData      map[string]any   `json:"channelData,omitempty"`
	MembersAdded     []ChannelAccount `json:"membersAdded,omitempty"`
	MembersRemoved   []ChannelAccount `json:"membersRemoved,omitempty"`
	ReplyToID        string           `json:"replyToId,omitempty"`
	TextFormat       string           `json:"textFormat,omitempty"`
	AttachmentLayout string           `json:"attachmentLayout,omitempty"`
}

Activity represents a Bot Framework Activity object.

type Channel

type Channel struct {
	ID          string `json:"id"`
	DisplayName string `json:"displayName"`
	Description string `json:"description,omitempty"`
}

Channel represents a Microsoft Teams channel.

type ChannelAccount

type ChannelAccount struct {
	ID          string `json:"id"`
	Name        string `json:"name,omitempty"`
	AADObjectID string `json:"aadObjectId,omitempty"`
}

ChannelAccount represents a user or bot account.

type ChannelInfo

type ChannelInfo struct {
	ID          string
	DisplayName string
	TeamID      string
	TeamName    string
}

ChannelInfo contains channel information resolved from the Graph API.

type ChannelMetadata

type ChannelMetadata struct {
	ID   string `json:"id" mapstructure:"id"`
	Name string `json:"name" mapstructure:"name"`
}

ChannelMetadata stores channel identification information.

type Client

type Client struct {
	AppID       string
	AppPassword string
	TenantID    string
	// contains filtered or unexported fields
}

Client handles Bot Framework REST API and Graph API interactions.

func NewClient

func NewClient(ctx core.IntegrationContext) (*Client, error)

NewClient creates a new Teams client from integration context.

func NewClientFromConfig

func NewClientFromConfig(appID, appPassword, tenantID string) *Client

NewClientFromConfig creates a client directly from config values.

func (*Client) FindChannelByID

func (c *Client) FindChannelByID(channelID string) (*ChannelInfo, error)

FindChannelByID searches all accessible teams for a channel matching the given ID.

func (*Client) GetBotToken

func (c *Client) GetBotToken() (*TokenResponse, error)

GetBotToken fetches a Bot Framework access token from Azure AD.

func (*Client) GetChannel

func (c *Client) GetChannel(teamID, channelID string) (*Channel, error)

GetChannel retrieves a specific channel by ID.

func (*Client) GetGraphToken

func (c *Client) GetGraphToken() (*TokenResponse, error)

GetGraphToken fetches a Microsoft Graph API access token from Azure AD.

func (*Client) ListTeamChannels

func (c *Client) ListTeamChannels(teamID string) ([]Channel, error)

ListTeamChannels lists channels in a specific team.

func (*Client) ListTeams

func (c *Client) ListTeams() ([]Team, error)

ListTeams lists all teams accessible by the app.

func (*Client) SendActivity

func (c *Client) SendActivity(serviceURL, conversationID string, activity Activity) (*Activity, error)

SendActivity sends an activity to a conversation via the Bot Framework REST API.

type ConversationInfo

type ConversationInfo struct {
	ID               string `json:"id"`
	Name             string `json:"name,omitempty"`
	IsGroup          bool   `json:"isGroup,omitempty"`
	ConversationType string `json:"conversationType,omitempty"`
	TenantID         string `json:"tenantId,omitempty"`
}

ConversationInfo represents a conversation.

type Entity

type Entity struct {
	Type      string          `json:"type"`
	Mentioned *ChannelAccount `json:"mentioned,omitempty"`
	Text      string          `json:"text,omitempty"`
}

Entity represents an entity in a message (mention, etc.).

type JWK

type JWK struct {
	KID string `json:"kid"`
	N   string `json:"n"`
	E   string `json:"e"`
	Kty string `json:"kty"`
}

JWK represents a single JSON Web Key.

type JWKS

type JWKS struct {
	Keys []JWK `json:"keys"`
}

JWKS represents a JSON Web Key Set.

type JWTValidator

type JWTValidator struct {
	// contains filtered or unexported fields
}

JWTValidator validates Bot Framework JWT tokens.

func NewJWTValidator

func NewJWTValidator(appID string) *JWTValidator

NewJWTValidator creates a new JWT validator for a given app ID.

func (*JWTValidator) ValidateToken

func (v *JWTValidator) ValidateToken(tokenString string) (*jwt.Token, error)

ValidateToken validates a Bot Framework JWT token.

type Metadata

type Metadata struct {
	AppID     string `json:"appId" mapstructure:"appId"`
	TenantID  string `json:"tenantId,omitempty" mapstructure:"tenantId,omitempty"`
	BotName   string `json:"botName,omitempty" mapstructure:"botName,omitempty"`
	Installed bool   `json:"installed,omitempty" mapstructure:"installed,omitempty"`
}

Metadata stores integration metadata after successful authentication.

type OnMention

type OnMention struct{}

OnMention triggers when the bot is @mentioned in a Teams channel.

func (*OnMention) Actions

func (t *OnMention) Actions() []core.Action

func (*OnMention) Cleanup

func (t *OnMention) Cleanup(ctx core.TriggerContext) error

func (*OnMention) Color

func (t *OnMention) Color() string

func (*OnMention) Configuration

func (t *OnMention) Configuration() []configuration.Field

func (*OnMention) Description

func (t *OnMention) Description() string

func (*OnMention) Documentation

func (t *OnMention) Documentation() string

func (*OnMention) ExampleData

func (t *OnMention) ExampleData() map[string]any

func (*OnMention) HandleAction

func (t *OnMention) HandleAction(ctx core.TriggerActionContext) (map[string]any, error)

func (*OnMention) HandleWebhook

func (*OnMention) Icon

func (t *OnMention) Icon() string

func (*OnMention) Label

func (t *OnMention) Label() string

func (*OnMention) Name

func (t *OnMention) Name() string

func (*OnMention) OnIntegrationMessage

func (t *OnMention) OnIntegrationMessage(ctx core.IntegrationMessageContext) error

func (*OnMention) Setup

func (t *OnMention) Setup(ctx core.TriggerContext) error

type OnMentionConfiguration

type OnMentionConfiguration struct {
	Channel       string `json:"channel" mapstructure:"channel"`
	ContentFilter string `json:"contentFilter" mapstructure:"contentFilter"`
}

OnMentionConfiguration defines the trigger's configurable fields.

type OnMentionMetadata

type OnMentionMetadata struct {
	Channel           *ChannelMetadata `json:"channel,omitempty" mapstructure:"channel,omitempty"`
	AppSubscriptionID *string          `json:"appSubscriptionID,omitempty" mapstructure:"appSubscriptionID,omitempty"`
}

OnMentionMetadata stores metadata after trigger setup.

type OnMessage

type OnMessage struct{}

OnMessage triggers when any message is posted in a Teams channel.

func (*OnMessage) Actions

func (t *OnMessage) Actions() []core.Action

func (*OnMessage) Cleanup

func (t *OnMessage) Cleanup(ctx core.TriggerContext) error

func (*OnMessage) Color

func (t *OnMessage) Color() string

func (*OnMessage) Configuration

func (t *OnMessage) Configuration() []configuration.Field

func (*OnMessage) Description

func (t *OnMessage) Description() string

func (*OnMessage) Documentation

func (t *OnMessage) Documentation() string

func (*OnMessage) ExampleData

func (t *OnMessage) ExampleData() map[string]any

func (*OnMessage) HandleAction

func (t *OnMessage) HandleAction(ctx core.TriggerActionContext) (map[string]any, error)

func (*OnMessage) HandleWebhook

func (*OnMessage) Icon

func (t *OnMessage) Icon() string

func (*OnMessage) Label

func (t *OnMessage) Label() string

func (*OnMessage) Name

func (t *OnMessage) Name() string

func (*OnMessage) OnIntegrationMessage

func (t *OnMessage) OnIntegrationMessage(ctx core.IntegrationMessageContext) error

func (*OnMessage) Setup

func (t *OnMessage) Setup(ctx core.TriggerContext) error

type OnMessageConfiguration

type OnMessageConfiguration struct {
	Channel       string `json:"channel" mapstructure:"channel"`
	ContentFilter string `json:"contentFilter" mapstructure:"contentFilter"`
}

OnMessageConfiguration defines the trigger's configurable fields.

type OnMessageMetadata

type OnMessageMetadata struct {
	Channel           *ChannelMetadata `json:"channel,omitempty" mapstructure:"channel,omitempty"`
	AppSubscriptionID *string          `json:"appSubscriptionID,omitempty" mapstructure:"appSubscriptionID,omitempty"`
}

OnMessageMetadata stores metadata after trigger setup.

type OpenIDConfiguration

type OpenIDConfiguration struct {
	JWKSURI string `json:"jwks_uri"`
}

OpenIDConfiguration represents the OpenID Connect discovery document.

type SendTextMessage

type SendTextMessage struct{}

SendTextMessage sends a text message to a Teams channel.

func (*SendTextMessage) Actions

func (c *SendTextMessage) Actions() []core.Action

func (*SendTextMessage) Cancel

func (c *SendTextMessage) Cancel(ctx core.ExecutionContext) error

func (*SendTextMessage) Cleanup

func (c *SendTextMessage) Cleanup(ctx core.SetupContext) error

func (*SendTextMessage) Color

func (c *SendTextMessage) Color() string

func (*SendTextMessage) Configuration

func (c *SendTextMessage) Configuration() []configuration.Field

func (*SendTextMessage) Description

func (c *SendTextMessage) Description() string

func (*SendTextMessage) Documentation

func (c *SendTextMessage) Documentation() string

func (*SendTextMessage) ExampleOutput

func (c *SendTextMessage) ExampleOutput() map[string]any

func (*SendTextMessage) Execute

func (c *SendTextMessage) Execute(ctx core.ExecutionContext) error

func (*SendTextMessage) HandleAction

func (c *SendTextMessage) HandleAction(ctx core.ActionContext) error

func (*SendTextMessage) HandleWebhook

func (*SendTextMessage) Icon

func (c *SendTextMessage) Icon() string

func (*SendTextMessage) Label

func (c *SendTextMessage) Label() string

func (*SendTextMessage) Name

func (c *SendTextMessage) Name() string

func (*SendTextMessage) OutputChannels

func (c *SendTextMessage) OutputChannels(configuration any) []core.OutputChannel

func (*SendTextMessage) ProcessQueueItem

func (c *SendTextMessage) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*SendTextMessage) Setup

func (c *SendTextMessage) Setup(ctx core.SetupContext) error

type SendTextMessageConfiguration

type SendTextMessageConfiguration struct {
	Channel string `json:"channel" mapstructure:"channel"`
	Text    string `json:"text" mapstructure:"text"`
}

SendTextMessageConfiguration defines the action's configurable fields.

type SendTextMessageMetadata

type SendTextMessageMetadata struct {
	Channel *ChannelMetadata `json:"channel" mapstructure:"channel"`
}

SendTextMessageMetadata stores metadata after action setup.

type SubscriptionConfiguration

type SubscriptionConfiguration struct {
	EventTypes []string `json:"eventTypes"`
}

SubscriptionConfiguration defines which event types a trigger subscribes to.

type Team

type Team struct {
	ID          string `json:"id"`
	DisplayName string `json:"displayName"`
	Description string `json:"description,omitempty"`
}

Team represents a Microsoft Teams team.

type Teams

type Teams struct{}

Teams implements the Microsoft Teams integration.

func (*Teams) Actions

func (t *Teams) Actions() []core.Action

func (*Teams) Cleanup

func (t *Teams) Cleanup(ctx core.IntegrationCleanupContext) error

func (*Teams) Components

func (t *Teams) Components() []core.Component

func (*Teams) Configuration

func (t *Teams) Configuration() []configuration.Field

func (*Teams) Description

func (t *Teams) Description() string

func (*Teams) HandleAction

func (t *Teams) HandleAction(ctx core.IntegrationActionContext) error

func (*Teams) HandleRequest

func (t *Teams) HandleRequest(ctx core.HTTPRequestContext)

func (*Teams) Icon

func (t *Teams) Icon() string

func (*Teams) Instructions

func (t *Teams) Instructions() string

func (*Teams) Label

func (t *Teams) Label() string

func (*Teams) ListResources

func (t *Teams) ListResources(resourceType string, ctx core.ListResourcesContext) ([]core.IntegrationResource, error)

func (*Teams) Name

func (t *Teams) Name() string

func (*Teams) Sync

func (t *Teams) Sync(ctx core.SyncContext) error

func (*Teams) Triggers

func (t *Teams) Triggers() []core.Trigger

type TokenResponse

type TokenResponse struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	ExpiresIn   int    `json:"expires_in"`
}

TokenResponse represents an OAuth2 token response from Azure AD.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL