1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Qiitaのアクセス数取得自動化 Teams編④

1
Posted at

データ連携に奮闘中の皆様、いかがお過ごしでしょうか。

本日は、前回作成したワークフローが動くかどうかを
テストしたいと思います。

事前に取得したWebhook URLと合言葉を以下に入れて、PowerShellで実行します。

$url    = "<コピーしたWebhook URL>"
$secret = "<ワークフローに設定した合言葉>"
$headers = @{ "x-webhook-secret" = $secret }
$body = @{
  type = "message"
  attachments = @(@{
    contentType = "application/vnd.microsoft.card.adaptive"
    content = @{
      type = "AdaptiveCard"; version = "1.4"
      body = @(@{ type = "TextBlock"; text = "テスト通知です" })
    }
  })
} | ConvertTo-Json -Depth 10
Invoke-RestMethod -Uri $url -Method Post -Headers $headers `
  -ContentType "application/json; charset=utf-8" `
  -Body ([Text.Encoding]::UTF8.GetBytes($body))

実行後はこちら! 特にエラーが表示されていないことを確認します。
image.png

設定したTeams側を確認し、正しくテストメッセージが通知されていることを確認します。
image.png

勘の鋭い方はお気づきかと思いますが、PowerShellと同様の内容を移植すれば、
自動通知もできてしまうということになります。

それでは次回HULFT Squareのスクリプトを見ていきましょう。

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?