Power AutomateTeams チャネル メンション

グループチャットにメンションを付けるやり方を前回は学んだので、今回はチャネルでやってみる。ただやると同じことするだけだろうから、全体メンションできるかやってみる。

先に結論。2021年6月現在まだできないようだ。よって今回は考察。
2021年12月時点でもできない模様。別の方法があればいいが。
2022年5月 以下で実現されていた。よって、このnoteは足掻いた記録程度のものとなる。

まずは特定ユーザへのメンションを作ってみる

「スケジュールクラウドフロー」を作る

Power AutomateTeams チャネル メンション

メンションを特定するために

Power AutomateTeams チャネル メンション

メールアドレスを入れる

Power AutomateTeams チャネル メンション

メッセージの投稿準備

Power AutomateTeams チャネル メンション

投稿チーム、チャネルを特定し、メッセージを決める。
※チームやチャネル、メンションのつけ方は前回を参照

Power AutomateTeams チャネル メンション

全体像はこんな感じ

Power AutomateTeams チャネル メンション

テストをするとこうなる

Power AutomateTeams チャネル メンション

メンションを全体メンションに変えてみる

「メッセージを投稿する」ではメンションがchannel、チャネル、チームがユーザじゃないので反応しない。

フローボットで投稿してみる

「メッセージをフローボットとしてチャネルに投稿する」では<at></at>を使うことでメンションができるとのことなのでやってみる。

Power AutomateTeams チャネル メンション

ひとまずメンションは飛ばせた。下のメッセージはいらないんだけどな。

Power AutomateTeams チャネル メンション

メッセージが一行なので<BR>を追加した。

Power AutomateTeams チャネル メンション

下のメッセージはいらないんだけど、改行は効いた

Power AutomateTeams チャネル メンション

「メッセージを投稿する」でも試してみた。
赤丸をクリックすることで、タグを入力できるようになる。

Power AutomateTeams チャネル メンション

以下のようにしてテスト

Power AutomateTeams チャネル メンション

無事投稿できた。

Power AutomateTeams チャネル メンション

しかし結局

<at></at>の間はメールアドレスを入れないといけないようなので、結局はうまくいかない。
私の調べ方が足りないかもしれないが、今後の開発を待ちたい。

次のアクション

チャネルのスレッドの題名に日付を入れてみたい。
出来た

  • チャネルのスレッドの題名に日付を入れてみたい。
    出来た。

  • 以前作成したFormsの結果を時限式に投稿させたい。

Power AutomateTeams チャネル メンション

posted at 2022-03-06

updated at 2022-03-15

背景

Tag 用のメンションが対応されたけど、予想とちょっと違ったので現時点での比較
会社で使えるコネクター部分をまとめておく

制約

Tag への登録数などの制限もあるので注意

概要

  1. Teams Channel 内 Tag を使った Mention (メンション)
  2. HTML タグを利用した、メンション比較
    • <at>
      • UserID, UserEMail を囲むことでメンション可能
        <at>{UserId}</at>
        <at>{UserEmail}</at>
    • <atTag>
      Power AutomateTeams チャネル メンション
      • TagID, TeamID を囲むことで、タグメンション可能
        <atTag><tagId>{id}</tagId><groupId>{teamId}</groupId></atTag>

List Tags は、以下とかで使えそう

  • 役割を Tag 設定しておいて、自動応答での役割担当へのメンション

<atTag> は、現状 Post as を User 以外で使うと以下エラーが出ます

atTagError

{
    "error": {
      "code": 400,
      "message": "Mentioning tags is currently only supported when posting as a user. Please change the poster type to user or remove the at mentions for tags.",
      "source": "japan-001.azure-apim.net",
      "path": "choose[22]\\when[1]",
      "policyId": "",
      "clientRequestId": "8bb1de33-5a77-4d97-b061-1bf73980a539"
    }
  }

Teams Channel Tag のメンション

以下二点のコネクターの利用例

DEPRECATED (廃止) がついてるのは、すぐに Version 2 とかにあがる?

直接取得して Tag メンション

  1. Team, Tag を選択して、
    Power AutomateTeams チャネル メンション
  2. 動的コンテンツから選択してしまえば
    Power AutomateTeams チャネル メンション
  3. こんな感じで使える
    Power AutomateTeams チャネル メンション

adaptive card の例だが、message でも同様

名称を指定して使う場合(tag 一覧から、名称一致を選択)

  1. 対象チームの Tag 一覧を取得して JSON 解析

    Power AutomateTeams チャネル メンション

  2. [displayName] で名称を抽出して
    以下では Filter array を利用しているのでそのまま使うなら First()?['id'] や [0]?['id'] という指定が必要

    Power AutomateTeams チャネル メンション

  3. [ID] を使って、メンションタグを生成

    Power AutomateTeams チャネル メンション

  4. 動的コンテンツ、もしくは、<atTag><tagId>{id}</tagId><groupId>{teamId}</groupId></atTag> で手書きする

    Power AutomateTeams チャネル メンション

  5. 利用例

    Power AutomateTeams チャネル メンション

<at> vs <atTag>

Tag Mention と User Mention を Adaptive Card と Message の二種類で実施した例が以下

何故か adaptive card の書式が変ではある

Power AutomateTeams チャネル メンション

あとがき

そのうち以下も対応されるといいね。

  • @team
  • @channel

<at>, <atTag> で TeamID や ChannelID を囲ってみたけど、全然ダメ。<atTag> は応答すら返ってこない。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information

What you can do with signing up