Repository navigation
Conversation
…response When the Chat app is configured as a Google Workspace Add-on, Google Chat sends events in Add-on format (commonEventObject.hostApp=CHAT). Previously, only MESSAGE events (chat.messagePayload) were handled. Other event types like ADDED_TO_SPACE and REMOVED_FROM_SPACE caused 400 errors, making Google Chat stop delivering events to the endpoint entirely. Changes: - Handle ADDED_TO_SPACE events (chat.addedToSpacePayload) - Handle REMOVED_FROM_SPACE events (chat.removedFromSpacePayload) - Move addOnBearerToken extraction before event-type branching - For unknown Add-on event types: return unknownAddonEvent flag so caller can respond 200 only after token verification (prevents auth bypass)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: deab8fda3d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } else { | ||
| // Unknown Add-on event type: return flag so caller can respond 200 | ||
| // after verifying the token (avoid auth bypass) | ||
| return { ok: false, unknownAddonEvent: true, addOnBearerToken }; |
There was a problem hiding this comment.
Respond for unknown Add-on events in header-auth flow
Returning unknownAddonEvent here does not set an HTTP response, but createGoogleChatWebhookRequestHandler's header-bearer path still short-circuits on if (!parsed.ok) return true. For requests that carry an Authorization header and an Add-on event type outside the handled set, the handler exits without res.end(...), so the client sees a hanging request until timeout (and likely retries/backoff) instead of a clear success/error response.
Useful? React with 👍 / 👎.
Greptile SummaryThis PR successfully fixes a gap in the Google Workspace Add-on webhook handler by adding support for Key improvements:
The implementation is correct and well-structured for the intended use case. Confidence Score: 4/5
Last reviewed commit: deab8fd |
|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing due to inactivity. |
Problem
When a Chat app is configured as a Google Workspace Add-on, Google Chat sends events in the Add-on format (
commonEventObject.hostApp === "CHAT").Previously, only MESSAGE events (
chat.messagePayload) were transformed. Other event types likeADDED_TO_SPACEandREMOVED_FROM_SPACEwere not handled, causing:400 'invalid payload'responses from OpenClawFix (monitor-webhook.ts)
ADDED_TO_SPACEevents viachat.addedToSpacePayloadREMOVED_FROM_SPACEevents viachat.removedFromSpacePayloadaddOnBearerTokenextraction before event-type branching (applies to all Add-on events)unknownAddonEventflag instead of responding200immediately — caller verifies token first, then responds200after successful auth (prevents authentication bypass)Security
The unknown-event
200response is only sent after bearer token verification, consistent with how all other event types are handled.How to Reproduce
ADDED_TO_SPACEin Add-on format → OpenClaw returns400Reference