咨询谷歌用户Webhook实际事件名称及文档与实际差异的补充资料
Great question—this mismatch between the documented event names and what's actually sent in the X-Goog-Resource-State header is a common gotcha for Google Workspace Webhook developers. Let's break this down clearly:
Observed vs. Documented Event Values
First, let's map what you've seen in real requests to the names listed in the official docs:
- Documented
add→ Actual value:create(this is what will appear inX-Goog-Resource-Statefor new user additions) - Documented
makeAdmin→ Actual value:make_admin(snake_case instead of camelCase for this event) deleteandupdate→ These match between docs and actual requests, no discrepancy here
Why the Discrepancy?
Google’s documentation often uses user-friendly camelCase labels for event categories, but the actual wire format (sent in headers) uses snake_case or more literal terms like create instead of add. This pattern shows up across multiple Google Workspace APIs and webhook systems—docs prioritize readability, while the actual payload/headers use consistent naming conventions for backend systems.
Alternative Official Documentation Sources
While the main event list might show the simplified names, you can find the exact header values in:
- Admin SDK Webhook Request Reference: Deep in the request structure section, the docs explicitly list the valid values for
X-Goog-Resource-State, includingcreateandmake_admin. - Google Webhook Testing Tool: When you use Google’s official tool to simulate user webhook events, the sample requests will include the real header values, which align with what you’ve observed.
Key Takeaway
Always rely on the actual header values (create, delete, make_admin, update) when building your webhook handler—these are the values that Google’s systems will send consistently. The documented names are more like aliases for clarity, not the literal values you’ll process.
内容的提问来源于stack exchange,提问作者jelder

