#Collab-Chat: Post
Posts any text to CollabChat in the Questetra Platform by specifying the channel. To post to an organization channel or a process channel, specify the ID (eg. “g12” or “p123”), and to a user-created channel, the channel name (eg. “general”).
Configs for this Auto Step
- StrConfA1
- A1: Set Text to Post#{EL}
- SelectConfA2
- A2: Select FILES DATA to Attach (Max 10)
- StrConfA3
- A3: Set URLs to Link (in each line if multiple) (Max 10)#{EL}
- BoolConfB0
- B0: Create a channel, Off or On
- StrConfB1
- B1: Set Channel to Post (eg “g12”, “general”) *#{EL}
- StrConfB2
- B2: To Cross Post, Set Channels on each line#{EL}
- StrConfC1
- C1: To Link to Main from Crospost, Set “${var[applicationRoot]}”#{EL}
- SelectConfC2
- C2: Select STRING to store URL of Main Message(
Script (click to open)
// Script Example of Business Process Automation
// for 'engine type: 3' ("GraalJS standard mode")
// cf. 'engine type: 2' ("GraalJS Nashorn compatible mode") (renamed from "GraalJS" at 20230526)
//////// START "main()" ////////////////////////////////////////////////////////////////
main();
function main(){
//// == Config Retrieving / 工程コンフィグの参照 ==
const strText = configs.get ( "StrConfA1" ); // NotRequired
const filesPocketAttach = configs.getObject ( "SelectConfA2" ); // NotRequired
const strUrls = configs.get ( "StrConfA3" ); // NotRequired
const boolCreateChannel = configs.getObject ( "BoolConfB0" ); // TOGGLE
const strMainChannel = configs.get ( "StrConfB1" ); /// REQUIRED
const strCrossChannels = configs.get ( "StrConfB2" ); // NotRequired
let arrCrossChannels = strCrossChannels !== "" ?
strCrossChannels.split("\n") :
null;
const strApplicationRoot = configs.get ( "StrConfC1" ); // NotRequired
const strPocketC2 = configs.getObject ( "SelectConfC2" ); // NotRequired
//// == Data Retrieving / ワークフローデータの参照 ==
let filesAttach = null;
if( filesPocketAttach !== null ){
filesAttach = engine.findData( filesPocketAttach );
// java.util.ArrayList
// List<com.questetra.bpms.core.event.scripttask.QfileView>
}
if( strText === "" && filesAttach === null && strUrls === "" ){
throw new Error( "\n AutomatedTask ConfigError:" +
" No data in Config {A1} {A2} {A3} \n" );
}
//// == Calculating / 演算 ==
/// create Channels
if ( boolCreateChannel ){
try {
feedService.createPublicChannel ( strMainChannel );
engine.log( " AutomatedTask: Channel created - " + strMainChannel );
} catch(e) { // if error, channel already exists, etc
engine.log( " AutomatedTask: Channel Creation " + strMainChannel + " - " + e.getMessage() );
}
for ( let i = 0; i < arrCrossChannels.length; i++ ){
if( arrCrossChannels[i] !== "" ){
try {
feedService.createPublicChannel ( arrCrossChannels[i] );
engine.log( " AutomatedTask: Channel created - " + arrCrossChannels[i] );
} catch(e) { // if error, channel already exists, etc
engine.log( " AutomatedTask: Channel Creation " + arrCrossChannels[i] + " - " + e.getMessage() );
}
}
}
}
/// prepare CollabChat Message
let chatMsg = feedService.begin(); // FeedServiceWrapper
// com.questetra.bpms.core.event.scripttask.FeedServiceWrapper
let strFooter = "\n\n -- auto posted to #" + strMainChannel;
if ( arrCrossChannels !== null ){
strFooter += " & crossposted to";
for ( let i = 0; i < arrCrossChannels.length; i++ ){
if( arrCrossChannels[i] !== "" ){
strFooter += " #" + arrCrossChannels[i];
}
}
}
chatMsg = chatMsg.setMessage( strText + "\n" + strFooter );
if( filesAttach !== null ){
let numFilesSize = filesAttach.size() - 0;
for( let i = 0; i < numFilesSize; i++ ){
chatMsg = chatMsg.attachFile( filesAttach.get(i) );
engine.log(
" AutomatedTask AttachedFile:" +
" '" + filesAttach.get(i).getName() + "'" +
" (" + filesAttach.get(i).getLength() + " byte)" +
" '" + filesAttach.get(i).getContentType() + "'"
);
}
}
if( strUrls !== "" ){
const arrUrls = strUrls.split("\n");
for( let i = 0; i < arrUrls.length; i++ ){
if( arrUrls[i] !== "" ){
chatMsg = chatMsg.attachLink( arrUrls[i] );
engine.log(
" AutomatedTask AttachedLink:" +
" '" + arrUrls[i] + "'"
);
}
}
}
/// post to Main channel
engine.log( " AutomatedTask CollabChat Main: Post" );
const numPostedMsgMain = chatMsg.setChannel( strMainChannel )
.post() - 0; // Java Long to Javascript number
engine.log( " AutomatedTask CollabChat Message ID: " + numPostedMsgMain );
const strMainUrl = strApplicationRoot +
"Feed/Timeline/message?messageId=" +
numPostedMsgMain;
// https://example.questetra.net/Feed/Timeline/message?messageId=103349204
// https://example.questetra.net/Feed/Timeline/Topic/104877766/Message/103349204
/// cross-post to Channels
if ( arrCrossChannels !== null ){
if( strApplicationRoot !== "" ){
chatMsg = chatMsg.attachLink( strMainUrl );
}
for ( let i = 0; i < arrCrossChannels.length; i++ ){
if( arrCrossChannels[i] !== "" ){
try {
engine.log( " AutomatedTask CollabChat Cross: Post" );
const numPostedMsgCross = chatMsg.setChannel( arrCrossChannels[i] )
.post() - 0; // Java Long to Javascript number
engine.log( " AutomatedTask CollabChat Message ID: " + numPostedMsgCross );
} catch(e) { // if error, channel already exists, etc
engine.log( " AutomatedTask Warning Channel not found: " + arrCrossChannels[i] );
}
}
}
}
//// == Data Updating / ワークフローデータへの代入 ==
if ( strPocketC2 !== null ){
engine.setData( strPocketC2, strMainUrl );
}
} //////// END "main()" /////////////////////////////////////////////////////////////////
/*
Notes:
- When the process reaches this automated step, the text is automatically posted.
- The posts will be made by the special author icon "Questetra" who cannot be followed.
- Specify the channel (main posting destination) to post to. (Standard config)
- For organization channels, set it in the format 'g1' or 'g123'.
- For process channels, set it in the format 'p1' or 'p123'.
- For process channel itself, set as 'p#{processInstanceId}'.
- Specify the channel to cross post to if necessary. (Expert config)
- The same text as the main post will be posted.
- No error will occur even if the channel does not exist. (Warning)
- The URL to the main post is also available.
- Useful to aggregate users' Comments on the main post.
APPENDIX-en:
- No need to set authentication or authorization (OAuth2) when modeling.
- There is no way to post from the standpoint of a specific user.
- There is no function to delete posts by special contributors (As of April 2025)
- Error will occur if more than 10 links or files are attached.
Notes-ja:
- 案件が自動工程に到達した際に、「投稿文」が自動投稿されます。 (CollabChat Post)
- 特別な投稿者「Questetra」のアイコンで投稿されます。
- 投稿先チャンネル(メイン投稿先)を指定します。 (Standard 設定)
- 組織チャンネルの場合、`g1` や `g123` のような書式でセットしてください。
- プロセスチャンネルの場合、`p1` や `p123` のような書式でセットしてください。
- 自身のプロセスチャンネルの場合、`p#{processInstanceId}` とセットしてください。
- 必要に応じてクロス投稿先のチャンネルを指定します。 (Expert 設定)
- メイン投稿と同じ文章が投稿されます。
- チャンネルが存在しない場合でもエラー終了しません。(Warning)
- メイン投稿へのURLを添付することも可能です。
- ユーザの[コメント]をメイン投稿で集約させたい場合などに便利です。
APPENDIX-ja:
- モデリング時に認証情報や認可(OAuth2)を設定する必要はありません。
- 特定ユーザの立場で投稿する方法はありません。
- 特別な投稿者の投稿(ワークフローエンジンの立場からの投稿)を削除する機能はありません。(2025年4月現在)
- リンクやファイルの添付が10を超えるとエラーになります。
*/
Download
- collab-chat-post-2025.xml
- 2025-04-22 (C) Questetra, Inc. (MIT License)
- collab-chat-post-202511.xml
- automatically truncates posts to 8000 characters
- 2025-11-25 (C) Questetra, Inc. (MIT License)
Freely modifiable JavaScript (ECMAScript) code. No warranty of any kind.
(Installing Addon Auto-Steps are available only on the Professional edition.)
(Installing Addon Auto-Steps are available only on the Professional edition.)
Notes
- When the process reaches the automated step, the text is automatically posted.
- The posts will be made by the special author icon “Questetra” who cannot be followed.
- Specify the channel (main posting destination) to post to. (Standard config)
- For organization channels, set it in the format
g1org123. - For process channels, set it in the format
p1orp123. - For process channel itself, set as
p#{processInstanceId}.
- For organization channels, set it in the format
- Specify the channel to cross post to if necessary. (Expert config)
- The same text as the main post will be posted.
- No error will occur even if the channel does not exist. (Warning)
- The URL to the main post is also available.
- Useful to aggregate users’ Comments on the main post.
Capture


Appendix
- No need to set authentication or authorization (OAuth2) when modeling.
- There is no way to post from the standpoint of a specific user.
- There is no function to delete posts by special contributors (As of April 2025)
- Error will occur if attached more than 10 links or files.
- An example of a regular expression for “multiple URLs per line” is
^(https:\/\/\S+\r?\n)*https:\/\/\S+$. - Cross-posting to other channels (no errors even if the channel has not been created)
#{#q_channelId == null ? '' : #q_channelId}
- Automatically posting process IDs and other information makes it easier for authorized users to access process data.
<#{processModelInfoName}> #p#{processInstanceId} ##{#q_channelId == null ? '' : #q_channelId} #{#q_user == null ? '' : 'by @[' + #q_user?.name + ']'}
Best Practice (Sales Negotiation report process)
- Create a
Sales-Advicechannel and aProduct-Needschannel as a place for internal discussion.- Create them as [User-created channels] (Public). // Mutual checks and balances for internal control
- (Make it a [Private] channel if confidential information is involved) // Add internal auditors
- Set the “Post text” for the automated step “#Collab-Chat: Post”.
- Set the variable (eg:
#{#q_opportunities}) for the data item “Prospective Opportunity Summary and Probability”. - Set the variable (eg:
#{#q_customer_needs}) for the data item “Customer Needs”. - Also set the variable (eg:
#p#{processInstanceId}) for the link to [Process Channel].- Users with the Workflow App privilege [Data Viewer] can easily transition to [Process Details].
- Set the variable (eg:
- Set the “Channel to Post” for the automated step “#Collab-Chat: Post”.
- Set
#Sales-Adviceas the main Channel. - Set
#Product-Needsas the Cross Post Channel.- Set to not crosspost if no value “Customer Needs”
#{#q_customer_needs == null ? '' : '#Product-Needs'}
- Set the customer channel
#{#q_customer_id}as the Cross Post Channel. (Customer Case Management)
- Set
