[Google Chat API + Apps Script] "Can't handle the app's response" error when clicking a card button (Web App / OAuth2)

31 views
Skip to first unread message

Lucas Sousa

unread,
Aug 25, 2026, 10:39:43 AM (13 days ago) Aug 25
to Google Apps Script Community

Hi everyone,

I'm building a Google Chat Bot integration using Google Apps Script and GCP Service Account (OAuth2).

The Flow:

  1. Form submitted -> Apps Script sends a Card message to a Google Chat space using UrlFetchApp and OAuth2 token. (This step works fine!).

  2. The user inputs text into the Card's textInput and clicks the "Submit" button.

  3. The card button calls processarRespostaChat / doPost.

The Issue: When the button is clicked, Google Chat shows an error in the UI and Cloud Logging records Code 3: "Can't handle the app's response. If your Chat app is configured as an add-on, see "Chat actions"..."

Configuration in Google Cloud Chat API:

My Apps Script Code:

var CHAT_WEBHOOK = "https://chat.googleapis.com/v1/spaces/XXX/messages?key=XXX&token=XXX";
var ID_ESPACO = "spaces/XXX";
var SERVICE_ACCOUNT_EMAIL = "b...@my-project.iam.gserviceaccount.com";
var PRIVATE_KEY = "-----BEGIN PRIVATE KEY-----\nMY_KEY\n-----END PRIVATE KEY-----\n";

function doGet(e) {
  return ContentService.createTextOutput("Bot Active");
}

function doPost(e) {
  var data = JSON.parse(e.postData.contents);
  var response = processarCliqueCard(data);
  return ContentService.createTextOutput(JSON.stringify(response))
    .setMimeType(ContentService.MimeType.JSON);
}

function processarCliqueCard(evento) {
  // Processes spreadsheet data and sends email...
  return {
    "actionResponse": { "type": "UPDATE_MESSAGE" },
    "text": "Success message"
  };
}

  Has anyone faced a similar Code 3 error when handling interactive cards via Web App HTTP URL in Google Chat? What am I missing in the response structure?  

Reply all
Reply to author
Forward
0 new messages