Documentation
¶
Overview ¶
Package teams is the Microsoft Teams adapter for botbooter. It implements core.Adapter, receiving messages from the Azure Bot Framework over an inbound webhook and replying through the Bot Connector REST API.
Like the WhatsApp adapter, the Bot Framework pushes inbound messages as HTTP callbacks, so this adapter runs its own server: Connect binds a listener and serves until the run context is canceled; Disconnect shuts it down. Bind a local Addr, put a TLS-terminating proxy in front, and register the public HTTPS URL as your Azure Bot resource's messaging endpoint.
Security: every inbound request is authenticated against the Bot Connector JWT (signature, audience, issuer, serviceurl claim, channel endorsement), and replies go only to allowlisted Bot Framework hosts. The Activity body itself is channel-trusted, not individually signed, with no replay tracking: terminate TLS at a trusted proxy, never expose the bind Addr in cleartext, and rate-limit at the proxy.
Implementation split: server.go (webhook lifecycle), auth.go (JWT/JWKS + SSRF checks), send.go (reply + token), message.go (parsing), attachments.go (attachment mapping), http.go (HTTP plumbing).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrMissingConfig = errors.New("teams: missing required config field")
ErrMissingConfig is returned by New when a required Config field is empty.
var ErrUnknownConversation = errors.New("teams: unknown conversation")
ErrUnknownConversation is returned by Send when no inbound Activity has been seen for the target conversation — so no serviceUrl is known — or it was evicted from the conversation map. Callers doing proactive sends can errors.Is-branch it from transport failures.
Functions ¶
func Addr ¶
Addr returns the address the bot's webhook listener is bound to (host:port), or "" if b is not a Teams bot or is not currently connected. It lets a caller that passed cfg.Addr ":0" discover the OS-assigned port.
Types ¶
type Config ¶
type Config struct {
// AppID is the Microsoft App (client) ID of the Azure Bot resource. It is
// the expected audience of inbound tokens and the client_id used to mint
// outbound tokens.
AppID string
// AppPassword is the client secret paired with AppID.
AppPassword string
// TenantID scopes the outbound token endpoint to a single tenant. Optional:
// when empty the multi-tenant ("botframework.com") endpoint is used.
TenantID string
// Addr is the local TCP address the webhook server binds, e.g. ":8080". A
// bare port ("8080") is accepted as shorthand for ":8080".
Addr string
// Path is the webhook route; it defaults to /api/messages.
Path string
HTTPClient *http.Client
}
Config configures a Microsoft Teams (Azure Bot Framework) bot.
type Message ¶
type Message struct {
ID string
ConversationID string
ServiceURL string
From string
AuthorName string
Text string
Timestamp time.Time
Raw json.RawMessage
// contains filtered or unexported fields
}
Message is the parsed payload of an inbound Bot Framework Activity. Raw holds the original Activity JSON for callers that need fields beyond these.