I am facing an issue when integrating a flow with Google Sheets via the External API Request block.
Have you checked for existing requests?
- [x] I have searched the existing issues and found no similar request.
Affected Component
🔀 Flow Builder (Flows, Tags, Custom Fields)
Deployment Environment
Self-Hosted (Docker Compose)
ChatbotX Version
latest
Describe the bug
External API Request does not recognize successful response from Google Apps Script, routing to Error and skipping final message
Steps To Reproduce
Here is the fully translated and focused GitHub issue in English, ready to be copy-pasted.
Title: External API Request does not recognize successful response from Google Apps Script, routing to Error and skipping final message
Description:
Hello ChatbotX team,
I am facing an issue when integrating a flow with Google Sheets via the External API Request block.
The core problem: Data is successfully written to the Google Sheet (meaning the request reaches the script and it executes). However, ChatbotX does not recognize the response from Google Apps Script as successful. It routes the flow to the Error branch and fails to show the final message to the user ("Thank you! Your request has been accepted...").
At the same time, the Error Logs (External Request type) are completely empty.
🛠 Our Configuration
1. Google Apps Script (deployed as Web App: Execute as: Me, Who has access: Anyone):
var SECRET_KEY = "MySuperSecretPassword123";
function doPost(e) {
try {
var data = JSON.parse(e.postData.contents);
} catch (error) {
return sendResponse("error", "Invalid JSON");
}
if (data.key !== SECRET_KEY) {
return sendResponse("error", "Access Denied");
}
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1");
if (!sheet) {
return sendResponse("error", "Sheet not found");
}
var rowData = [
new Date(),
data.name || "Not specified",
data.phone || "No phone",
data.service || "Not selected"
];
sheet.appendRow(rowData);
// We tried different response formats — the result is always the same.
// 1. return ContentService.createTextOutput("OK").setMimeType(ContentService.MimeType.TEXT);
// 2. return sendResponse("success", "Data added");
return ContentService.createTextOutput("OK").setMimeType(ContentService.MimeType.TEXT);
}
function sendResponse(status, message) {
return ContentService.createTextOutput(JSON.stringify({ status: status, message: message })).setMimeType(ContentService.MimeType.JSON);
}
2. External API Request block settings in ChatbotX:
- Method:
POST - URL:
https://script.google.com/macros/s/.../exec - Headers:
Content-Type: application/json(also triedtext/plain) - Body Type:
JSON - Body:
{
"key": "MySuperSecretPassword123",
"name": "{{client_name}}",
"phone": "{{client_phone}}",
"service": "Dentistry/Car Service"
}
🐛 Steps to Reproduce
- Create a Google Apps Script with the code above and deploy it as a Web App.
- In ChatbotX, create an
External API Requestblock with the settings above. - In the flow, connect the green
Successoutput of theExternal API Requestblock to aSend Messageblock containing the text "Thank you". - Complete the flow in Telegram until the end (enter name, phone number).
❌ Actual Result
- Data (name, phone) successfully appears in the Google Sheet.
- The user does not receive the "Thank you" message.
- There are no error records in ChatbotX (in Error Logs).
- If we manually add an additional edge from the red
Erroroutput to the "Thank you" block, the message is delivered. This confirms that ChatbotX is somehow routing the request to theErrorbranch.
🔍 What We Have Already Tried
- Changed the script response: returned
{"status":"success"},{"status":"error"}, and plain text"OK". ChatbotX still routes toError. - Changed
Content-Type: triedapplication/json,text/plain. The result is the same. - Configured
Pick JSON path: tried to set$.statusand paste a sample JSON response into thePaste samplefield. Upon saving, the field is cleared, and the setting is not preserved (this might be an interface bug that prevents correct parsing). - Checked
Error Logs: there are no records under theExternal Requesttype.
💡 Additional Information
- ChatbotX Version: Community Edition (self-hosted, Docker).
- Channel: Telegram.
Pick JSON pathissue: the field does not save the entered data, which may be related to ChatbotX failing to parse the response from Google Script correctly due to redirects or CORS specifics.
Expected behavior
The External API Request block should correctly process the response from Google Apps Script (even if it is plain text "OK" or JSON {"status":"success"}) and route the flow via the Success branch, showing the user the final message.