Microsoft Teams Post Message (Incoming Webhook)

Microsoft Teams Post Message

Microsoft Teams メッセージ投稿

Posts a message to a Microsoft Teams chat using the Incoming Webhook.

Auto Step icon
Configs for this Auto Step
conf_EndpointUrl
A: Endpoint URL *
conf_Title
B: Select TEXT DATA for Title
conf_Text
C: Select TEXT DATA for Text *
conf_Log
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

warning Freely modifiable JavaScript (ECMAScript) code. No warranty of any kind.
(Installing Addon Auto-Steps are available only on the Professional edition.)

Notes

Capture

Discover more from Questetra Support

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

Continue reading

Scroll to Top