The Way to Integrate LINE with Workflows
Integrating with Questetra via LINE API


I’ve covered many system integration articles.
*You can visit here for the past articles


Now, I will share the integration with LINE.
I initially started to experiment with whether I could make a LINE bot with Questetra, but I found there were some things that Questetra couldn’t do and processing speed problems so I stopped developing a bot. (I’ll mention the reason later.)


However, I could specify users and groups from Questetra and send messages to LINE, so I’m sure you can use it to notify of the completion of a process.

*I often hear of some cases of integration with slack for notifications to social media tools – we haven’t heard any examples of cooperation with Chatwork, but we have verified that it is technically possible.

I’ve been asked about the integration with LINE several times. LINE has an advantage because it has a wide base of general users and low educational cost of tools, so I wonder how Works Mobile, the business version of LINE, will expand in the future.

Anyway, I will explain about the integration with LINE.


Table of Contents
1: The collaboration mechanism between LINE and Questetra
2: LINE settings
3: Questetra settings
4: The reason why I stopped developing a bot
5: Summary


1: The collaboration mechanism between LINE and Questetra

As shown in the image below, you can simply send an http request via authentication by the LINE API specification.
*You can click here for the LINE API specification.


2: LINE settings

You can set up a bot referring to steps on the following page.
“Building a bot”


3: Questetra settings

In the beginning, I tried to use the “Throwing Message Intermediate Event (HTTP)” to send an http request, but I couldn’t do that due to having to set up the LINE access token in the Authorization Bearer of the http header to pass authentication. But with a Script Task, it was possible, so I used it instead.

*Please refer to the page below for “Script Task”.
M230: Auto Executing Complicated Data Processing (ECMAScript)

You can refer to the following sample of the “Script Task”. The point is the bearer that I mentioned earlier. You can even use this method of setting up the bearer when connecting with other Apps.

var token= 
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; //Access Token acquiring from the monitoring screen of LINE
var json = data.get("0"); //JSON format data for transmitting to LINE

var response = httpClient.begin()
.body(json, "application/json")

var code = response.getStatusCode() + "";
var text = response.getResponseAsString() + "";

retVal.put("3", code); //Store the processing results
retVal.put("1", text); //Store the processing results

You can transmit the JSON format data to LINE as below.

    "to": "(posting id)",
            "text":"(posting message)"

It was a little troublesome to check the “posting id” as in the picture above because when you post a message on LINE you need to be set up to receive a webhook and pull it out of the http request. (Please let me know if you know an easier way.) Therefore, you will need something like an adapter program made with Google Apps Script, which I will mention later.

4: The reason why I stopped developing a bot

First, I struggled with the fact that webhooks from LINE cannot directly be received on Questetra.
The form of http requests sent from LINE and ones that Questetra can receive in Message Start Event (HTTP) are designated differently, so it wasn’t possible to conform to LINE specifications. Therefore, I dealt with that by introducing an adapter program.
I was able to receive an http request from LINE on Google Apps Script (GAS) and modified it to send it to Questetra.
*You can use other adapter programs such as heroku and AWS Lambda + API Gateway instead of Google Apps Scripts.
*For more information on “Message Start Event (HTTP)” please refer to the page below.
M221: Auto Start Triggered by HTTP Request

*Additional information (Mar.19, 2018):
The following new version of our Workflow product allows you to receive a webhook directly.

Cloud BPM v11.6 Supports Webhook Start

*Incidentally, the latest version (Feb 2020) is v11.13 and you can automatically generate text files as well as receive a webhook in this version.

Cloud BPM v11.13: Automatic Text-file Generation is Now available

However, it took me about 20 seconds to receive a reply from the following mechanism that I set up, so I stopped developing the bot.

This is the model. (I set the “Start Manually” icon for testing)

You can refer to the GAS sample code below. After receiving an http request from LINE, I pull the necessary data, such as replyToken, out of the code and send it to Questetra.
*You can replace the field names of “&q_reply_token=” or “&q_message =” with “&data[0].input=”, a standard destination in the parameter specification.

var SHEET_ID = "xxxxxxxxxxxxxxxxxxxx"; //enter Google Spreadsheet's id
var SHEET_NAME_LOG = "logs"; //Prepare the "logs" sheet beforehand
var QBPMS_URL = ""; //Adapt to the environment of Questetra
var QBPMS_PROCESS_MODEL_INFO_ID = "999"; //Adapt to the process model of Questetra
var QBPMS_NODE_NUMBER = "0"; //Adapt to process model of Questetra
var QBPMS_KEY = "xxxxxxxxxx"; //Adapt to the environment of Questetra

function doGet(e) {
return receive_(e);

function doPost(e) {
return receive_(e);

* Process the received http request
function receive_(e) {
var sheet_log = SpreadsheetApp.openById(SHEET_ID).getSheetByName(SHEET_NAME_LOG);

//Output log of the received http request
sheet_log.appendRow([ logDate(), "receive" ]);
sheet_log.appendRow([ logDate(), "JSON.stringify(e):\n" + JSON.stringify(e) ]);
var receiveJson = JSON.parse(e.postData.contents);
var replyToken =[0].replyToken;
var message =[0].message.text;
sheet_log.appendRow([ logDate(), "replyToken:\n" + replyToken ]);
sheet_log.appendRow([ logDate(), "message:\n" + message ]);

var url = QBPMS_URL;
var payload = 'processModelInfoId=' + QBPMS_PROCESS_MODEL_INFO_ID
+ '&nodeNumber=' + QBPMS_NODE_NUMBER
+ '&key=' + QBPMS_KEY
+ '&q_reply_token=' + replyToken
+ '&q_message=' + message;
sheet_log.appendRow([ logDate(), "payload:\n" + payload ]);

var options = {
"method" : 'post',
"payload" : payload

var response = UrlFetchApp.fetch(url, options);
sheet_log.appendRow([ logDate(), "response:\n" + response.getContentText() ]);

return HtmlService.createHtmlOutput();

* Create the datetime strings for outputting logs
function logDate() {
return Utilities.formatDate(new Date(), "JST", "yyyy-MM-dd HH:mm:ss");

You can refer to the sample of json data generation script in the “Script Task”. I set up the bot where the received message can be used for posting.
*Where the parameters are specified using a standard specification such as “data.get(“0”)” it is safe to use “data.get(“q_reply_token”)” and the field name.

var replyToken = data.get("0") + ""; //reply Token
var message = data.get("1") + ""; //Posting message

var jsonObj = {

var jsonObj2 = {

jsonObj2.text = message;
jsonObj.replyToken = replyToken;
jsonObj.messages[0] = jsonObj2;

var jsonText = JSON.stringify(jsonObj);

retVal.put("3", jsonText);

You can refer to the following sample of the “Script Task” for sending an http script.

var token = data.get("2"); //Access Token accuiring from the monitoring screen of LINE
var json = data.get("3"); //JSON format data for transmitting to LINE

var response = httpClient.begin()
.body(json, "application/json")

var code = response.getStatusCode() + "";
var response = response.getResponseAsString() + "";

retVal.put("4", code); //Store the processing results
retVal.put("5", response); //Store the processing results


5. Summary

I’ve explained some methods of integration with LINE in this article. However, with the methods I have described, you can set LINE to, for example, notify you if a customer applies for a seminar.
You can set various notifications depending on the process model design in Questetra, such as sending a notification to LINE when receiving an order, or after solving some trouble.

Other collaborations are possible, such as starting a process when a LINE post contains a specific keyword, though the adapter program for receiving a webhook mentioned above is necessary. For example, if a post contains the keywords “business card shortages”, it could trigger the process to order more business cards.


If you have any questions, please contact us via the inquiry form.


About The Author

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top