ChatWork Add Message
Adds a message to specified room of Chatwork.
Configs
  • A: API Token *
  • B: Select TEXT DATA for Room Id *
  • C: Select TEXT DATA for Message *
  • X: Select TEXT DATA for Log
Script (click to open)

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


//// == ワークフローデータの参照 / Data Retrieving ==
var roomId = engine.findDataByNumber( configs.get("conf_RoomId") ) + "";
var message = engine.findDataByNumber( configs.get("conf_Message") ) + "";


//// == 演算 / Calculating ==
var uri = "https://api.chatwork.com/v2/rooms/" + roomId + "/messages";

var response = httpClient.begin()
  .header( "X-ChatWorkToken", apiToken )
  .formParam( "body", message )
  .post( uri );


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

Download

2021-03-01 (C) Questetra, Inc. (MIT License)
https://support.questetra.com/addons/chatwork-messageadd/
The Addon-import feature is available with Professional or Enterprise edition.

Notes

Capture

%d bloggers like this: