Skip to content

Commit

Permalink
Deprecate API interface, add user mention support
Browse files Browse the repository at this point in the history
Summary:

- deprecate the current `API` interface
- expose `TeamsClient` to take its place
- create common interfaces and helper code to abstract any specific
  Microsoft Teams message format
- create new `botapi` package (limited functionality)
- extend existing `MessageCard` type (where needed) type to support
  new behavior
- port existing `goteamsnotify.MessageCard` types/functions/methods to
  a new `messagecard` package and deprecate existing `MessageCard`
  functionality provided by the `goteamsnotify` "base" package
- update examples to reflect changes
- restore support for overriding default `http.Client`
- restore default project-specific user agent, support for
  overriding the default from client code

While making these changes I've refactored code and attempted to
clearly communicate which existing code/functionality is being
deprecated, all without introducing breaking changes for client code.

The `botapi` package added in this collection of changes is a minimal
implementation. This package is intended to provide limited user
mention functionality for channel updates as a "bridge" until future
`Adaptive Card` support can be implemented.

A future implementation of `Adaptive Card` support would provide a
more complete experience, presumably providing a superset of the
limited support in the `botapi` package and existing `MessageCard`
functionality.

refs GH-127
refs GH-134
refs GH-135
refs GH-154
  • Loading branch information
atc0005 committed Feb 25, 2022
1 parent 137175c commit 59c75e0
Show file tree
Hide file tree
Showing 14 changed files with 1,749 additions and 171 deletions.
19 changes: 18 additions & 1 deletion README.md
@@ -1,7 +1,7 @@
<!-- omit in toc -->
# go-teams-notify

A package to send messages to Microsoft Teams (channels)
A package to send messages to a Microsoft Teams channel.

[![Latest release][githubtag-image]][githubtag-url]
[![Go Reference][goref-image]][goref-url]
Expand All @@ -27,6 +27,8 @@ A package to send messages to Microsoft Teams (channels)
- [How to create a webhook URL (Connector)](#how-to-create-a-webhook-url-connector)
- [Examples](#examples)
- [Basic](#basic)
- [User Mention](#user-mention)
- [Set custom user agent](#set-custom-user-agent)
- [Add an Action](#add-an-action)
- [Disable webhook URL prefix validation](#disable-webhook-url-prefix-validation)
- [Enable custom patterns' validation](#enable-custom-patterns-validation)
Expand Down Expand Up @@ -58,6 +60,7 @@ information.
`Facts`) and/or externally hosted images. or images (hosted externally)
- Support for [`Actions`][msgcard-ref-actions], allowing users to take quick
actions within Microsoft Teams
- Support for [user mentions][botapi-user-mentions] (limited)
- Configurable validation of webhook URLs
- enabled by default, attempts to match most common known webhook URL
patterns
Expand Down Expand Up @@ -184,6 +187,18 @@ This is an example of a simple client application which uses this library.

File: [basic](./examples/basic/main.go)

#### User Mention

This example illustrates the use of a user mention.

File: [basic](./examples/user-mention/main.go)

#### Set custom user agent

This example illustrates setting a custom user agent.

File: [custom-user-agent](./examples/custom-user-agent/main.go)

#### Add an Action

This example illustrates adding an [`OpenUri Action`][msgcard-ref-actions] to
Expand Down Expand Up @@ -241,3 +256,5 @@ using either this library or the original project.

[msgcard-ref]: <https://docs.microsoft.com/en-us/outlook/actionable-messages/message-card-reference>
[msgcard-ref-actions]: <https://docs.microsoft.com/en-us/outlook/actionable-messages/message-card-reference#actions>

[botapi-user-mentions]: <https://docs.microsoft.com/en-us/microsoftteams/platform/bots/how-to/conversations/channel-and-group-conversations?tabs=json#work-with-mentions>

0 comments on commit 59c75e0

Please sign in to comment.