teams

package
v0.1.7 Latest Latest
Warning

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

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

Documentation

Overview

Package teams provides a Messenger adapter for Microsoft Teams using the Bot Framework protocol for bi-directional communication.

The adapter wraps github.com/infracloudio/msbotbuilder-go and exposes an HTTP endpoint that receives Bot Framework activities. Outgoing messages are sent as proactive messages through the Bot Framework REST API.

Transport: HTTP webhook (public endpoint required).

Authentication

A Bot Framework App ID and App Password are required. These are obtained from the Azure Bot registration portal.

Usage

m, err := teams.New(teams.Config{
	AppID:       os.Getenv("TEAMS_APP_ID"),
	AppPassword: os.Getenv("TEAMS_APP_PASSWORD"),
	ListenAddr:  ":3978",
})
if err != nil { /* handle */ }
if err := m.Connect(ctx); err != nil { /* handle */ }
defer m.Disconnect(ctx)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// AppID is the Microsoft Bot Framework App ID.
	AppID string
	// AppPassword is the Microsoft Bot Framework App Password.
	AppPassword string
	// ListenAddr is the address to listen on for incoming activities (e.g., ":3978").
	ListenAddr string
}

Config holds Teams-specific configuration.

type Messenger

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

Messenger implements the messenger.Messenger interface for Microsoft Teams. It provides an HTTP handler for receiving Bot Framework activities and uses the adapter to send proactive messages. The caller is responsible for mounting the handler on a shared HTTP mux.

func New

func New(cfg Config, opts ...messenger.Option) (*Messenger, error)

New creates a new Teams Messenger with the given config and options.

func (*Messenger) Connect

func (m *Messenger) Connect(ctx context.Context) (http.Handler, error)

Connect initializes the Teams Bot Framework adapter and returns an http.Handler for receiving Bot Framework activities. The caller mounts this handler on a shared HTTP mux at the desired context path (e.g., /agents/{name}/teams/events).

The adapter DOES NOT start its own http.Server.

func (*Messenger) ConnectionInfo

func (m *Messenger) ConnectionInfo() string

ConnectionInfo returns connection instructions for the Teams adapter.

func (*Messenger) Disconnect

func (m *Messenger) Disconnect(ctx context.Context) error

Disconnect gracefully shuts down the Teams adapter.

func (*Messenger) FormatApproval

FormatApproval builds a Microsoft Teams Adaptive Card for an approval notification. This satisfies the messenger.ApprovalFormatter interface, keeping all Teams-specific formatting inside the adapter.

func (*Messenger) FormatClarification

FormatClarification builds a Teams Adaptive Card for a clarification question.

func (*Messenger) Platform

func (m *Messenger) Platform() messenger.Platform

Platform returns the Teams platform identifier.

func (*Messenger) Receive

func (m *Messenger) Receive(_ context.Context) (<-chan messenger.IncomingMessage, error)

Receive returns a channel of incoming messages from Teams.

func (*Messenger) Send

Send delivers a message to a Teams conversation. If req.Metadata["attachments"] contains a []schema.Attachment, the message is sent with Adaptive Card formatting (the text field is used as the plaintext fallback).

func (*Messenger) UpdateMessage

func (m *Messenger) UpdateMessage(_ context.Context, _ messenger.UpdateRequest) error

UpdateMessage is a no-op for Teams — the adapter does not currently support editing previously sent messages. Returns nil to satisfy the Messenger interface without error. Teams Adaptive Card updates will be added incrementally.

Jump to

Keyboard shortcuts

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