1

I am attempting to deploy a simple Google Chat application using Python (FastAPI/Functions Framework) and an ngrok tunnel as the endpoint.

My goal is to create a standard, text-only chatbot that responds to user messages with the simplest possible JSON, like {"text": "Hello"}.

The Problem

Despite following the official Google Chat documentation for setting up an interactive app, my server responses are being rejected by the Google Cloud endpoint with an error indicating the request is being processed by the Workspace Add-ons pipeline (gsuiteaddons.googleapis.com), which requires a legacy card/action response structure.

Every attempt to respond with a standard Chat API format fails, resulting in the following pattern of errors (simplified for clarity):

Attempt 1: Standard Chat App Response (Desired)

When responding with: {"text": "Test"}

Error Log Message:

Failed to parse JSON as RenderActions, DataActions or Card. Failed with error: Cannot find field: text in message google.apps.card.v1.RenderActions

Attempt 2: Minimal Modern Card Response

When responding with a modern cardsV2 structure (which is what the documentation suggests for modern card replies):

JSON

{
    "cardsV2": [{ ... minimal card structure ... }]
}

Error Log Message:

Failed to parse JSON as RenderActions, DataActions or Card. Failed with error: Cannot find field: cardsV2 in message google.apps.card.v1.RenderActions

Attempt 3: Action Response Wrapper

When responding with the Add-on action wrapper (actionResponse + cardsV2):

JSON

{
    "actionResponse": { "type": "NEW_MESSAGE" },
    "cardsV2": [{ ... }]
}

Error Log Message:

Failed to parse JSON as RenderActions, DataActions or Card. Failed with error: Cannot find field: actionResponse in message google.apps.card.v1.Card

Attempt 4:Stack Overflow solution

When responding with the Add-on action wrapper (actionResponse + cardsV2):

I also tried the solution proposed in: Google Chat App on Cloud Functions (2nd gen) – response fails

Error Log Message:

Failed to parse JSON as RenderActions, DataActions or Card. Failed to parse JSON as RenderActions. Failed with error: Expect message object but got: ["{\"hostAppDataAction\": {\"chatDataAction\": {\"createMessageAction\": {\"message\": {\"text\": \"test\"}}}}}",200,{"Content-Type":"application/json"}] Failed to parse JSON as DataActions. Failed with error: Expect message object but got: ["{\"hostAppDataAction\": {\"chatDataAction\": {\"createMessageAction\": {\"message\": {\"text\": \"test\"}}}}}",200,{"Content-Type":"application/json"}] Failed to parse JSON as Card. Failed with error: Expect message object but got: ["{\"hostAppDataAction\": {\"chatDataAction\": {\"createMessageAction\": {\"message\": {\"text\": \"test\"}}}}}",200,{"Content-Type":"application/json"}] "

My Configuration

  • Platform: Google Cloud Project

  • APIs Enabled: Only Google Chat API is explicitly enabled. (Google Workspace Add-ons API is not enabled).

  • Chat API Config:

    • Interactive features: Enabled (to allow endpoint setting).

    • Connection settings: App URL with ngrok is configured. I receive correctly the messages

    • Functionality: Slash Commands and Dialogs are empty/disabled.

  • Server Code: Python returns Response(content=json.dumps(payload), media_type="application/json", status_code=200).

The Question

How can I force my Google Cloud Project to route interaction events through the standard Google Chat API pipeline (chat.googleapis.com) instead of the legacy Google Workspace Add-ons pipeline (gsuiteaddons.googleapis.com) so that my simple {"text": "..."} responses are accepted?

Is there a hidden setting in the Google Cloud or Google Workspace Admin Console that designates the deployment as an Add-on versus a standard Chat App, despite the API configuration?

1 Answer 1

0

Looks like your project got configured as a Workspace Add-on instead of a Chat App. Try just create new project, and enable only Chat API

Or return add on format:

return {
    "hostAppDataAction": {
        "chatDataAction": {
            "createMessageAction": {
                "message": {"text": "works!"}
            }
        }
    }
}

Check on GitHub

Sign up to request clarification or add additional context in comments.

1 Comment

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.