3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ATOM Liteを使ってTeamsに通知を行う

Posted at

先日、**「リモートワークで職場に荷物が届いたことをATOM LiteとAzure Logic Appsを使って通知させる」**という記事を書いて、「Azure Logic Appsを使ってTeamsに通知するやり方」を公開したのですが、「Webhookを使用するなら、Azure Logic Appsは不要なのでは?」という問いかけを貰ったので試してみました。

結論

Azure Logic Appsを使わなくても、ATOM Liteを使ってTemsへの通知が出来ました。

以前のシステム構成

Azure Logic Appsを経由する構成
image.png

今回のシステム構成

ダイレクトにTeamsに通知する構成
image.png

変更点

  • ATOM LiteのHTTPリクエストのURLに、Teamsの[Incoming Webhook]を使用
  • HTTPリクエストは、GETからPOSTに変更
  • POSTメソッドの引数に、表示したいコメントを入れる
  HTTPClient http;
  String url = "https://xxxxxxxxxx";  // TeamsのIncoming WebhookのURL
  //Serial.println("connect url: " + url);

  if (http.begin(url))
  {
    Serial.print("[HTTP] POST...\n");
    // start connection and send HTTP header
    String payload = "{'text':'荷物が届いたよ'}";
    int httpCode = http.POST(payload);

以前のソースコードからの変更箇所です。全ソースコードは前の記事を参考にして下さい。

まとめ

シンプルにTeamsと連携させたいなら、この方法が手っ取り早くて良いと思います。一方、クラウド側で処理を追加したり、分岐して並列で別な処理をさせたりしたいなどがあれば、以前の方法が良いと思います。あとは、ケースバイケースだと思うので好きに使って下さい。ATOM Liteは安くて便利です。

3
3
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
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?