LoginSignup
4
6

More than 3 years have passed since last update.

PowerAutomateとPowerVirtualAgentsを連携して画像を応答するには

Last updated at Posted at 2020-06-19

Power Virtual Agents において、画像や動画を応答する機能の GA が2021年1月に延期されたようだ。
https://docs.microsoft.com/ja-jp/power-platform-release-plan/2020wave2/power-virtual-agents/planned-features

そんなに待てないせっかちさんのために、Power Automate と連携して画像や動画を応答する方法を紹介する。

Power Automate

https://flow.microsoft.com にサインインし、ボットから呼び出すフローを作成する。

  1. ソリューションの Common Data Services Default Solution をクリック。
    image.png

  2. 新規のフローをクリック。
    image.png

  3. トリガー ”Power Virtual Agents がフローを呼び出すタイミング” を追加。
    image.png

  4. アクション ”変数を初期化する” を追加。
    image.png

  5. 任意の名前で文字列変数を定義する。値には、画像を Markdown の書式で入力。
    image.png

  6. アクション ”Power Virtual Agents に値を返す” を追加。
    image.png

  7. 任意の名前でテキストを定義し、前ステップで設定した変数を割り当て、保存。
    image.png

  8. 最後に、デフォルトのフロー名が分かりにくいので変更しておくと良い。
    image.png
    image.png

Power Virtual Agents

https://powerva.microsoft.com にサインインし、ボット本体を作成する。

  1. 右上のロボットマークから +New bot をクリック。
    image.png

  2. ボット名を決め、Power Automate と同じ環境を指定して Create をクリック。
    image.png

    A flow can only be called from a topic located in the same Common Data Service environment as your bot. Flows must also be in a solution in Power Automate. You can move flows into solutions so they are listed in the authoring canvas.
    https://docs.microsoft.com/en-us/power-virtual-agents/advanced-flow

  3. TopicsNew topic の順にクリック。
    image.png

  4. トピック名を決め、Trigger phrases(ボットを呼び出すための言葉。複数指定できる)を追加して、キャンバスへ。
    image.png

  5. Action を追加し、Power Automate で作成したフローを指定。
    image.png

  6. フローが返す変数を Message に渡す。
    image.png

  7. ボットをテストし、画像が表示されることを確認。
    image.png

Teams連携

Teams でも画像が表示されることを確認できた。
image.png

参考

本記事は、Power Virtual Agents コミュニティに挙がっていた下記スレッドを参考にしている。
https://powerusers.microsoft.com/t5/Calling-Actions-from-PVA/PVA-Response-Support-some-portions-of-Markdown-formatting/td-p/409413
こちらでは、トリガーに ”HTTP要求の受信時” 、最後のアクションに ”応答” を利用しているが、それでも動く。

4
6
0

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
  3. You can use dark theme
What you can do with signing up
4
6