Microsoft Teams Post Message (Incoming Webhook)

Microsoft Teams Post Message (Incoming Webhook)
Posts a message to a Microsoft Teams chat using the Incoming Webhook.
Configs
  • A: Endpoint URL *
  • B: Select TEXT DATA for Title
  • C: Select TEXT DATA for Text *
  • X: Select TEXT DATA for Log
Script (click to open)

//// == コンフィグの参照 / Config Retrieving ==
var endpointUrl = configs.get("conf_EndpointUrl") + "";

//// == ワークフローデータの参照 / Data Retrieving ==
var dataNum_Title = configs.get("conf_Title") + "";
var title = "";
if (dataNum_Title !== "") {
  title = engine.findDataByNumber( configs.get("conf_Title") ) + "";
}
var text = engine.findDataByNumber( configs.get("conf_Text") ) + "";

//// == 演算 / Calculating ==
var uri = endpointUrl;

var requestObj = {
  "title": "",
  "text": ""
};
requestObj.title = title;
requestObj.text = text;

var response = httpClient.begin()
  .body( JSON.stringify( requestObj ), "application/json")
  .post( uri );

//// == ワークフローデータへの代入 / Data Updating ==
//ログデータの指定があれば
var dataNum_Log = configs.get("conf_Log") + "";
if (dataNum_Log !== "") {
  var log = "";
  log += "---POST request--- " + response.getStatusCode() + "\n";
  log += response.getResponseAsString() + "\n";
  engine.setDataByNumber( dataNum_Log, log );
}

Download

2021-04-16 (C) Questetra, Inc. (MIT License)
https://support.questetra.com/addons/microsoftteams-messagepost/
The Addon-import feature is available with Professional edition.

Notes

Capture

Scroll to Top

Discover more from Questetra Support

Subscribe now to keep reading and get access to the full archive.

Continue reading