Method: spaces.messages.patch
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
메시지를 업데이트합니다. patch
메서드와 update
메서드 간에는 차이가 있습니다. patch
메서드는 patch
요청을 사용하고 update
메서드는 put
요청을 사용합니다. patch
메서드를 사용하는 것이 좋습니다. 예는 메시지 업데이트를 참고하세요.
다음 유형의 인증을 지원합니다.
앱 인증을 사용하는 경우 요청은 호출하는 Chat 앱에서 만든 메시지만 업데이트할 수 있습니다.
HTTP 요청
PATCH https://chat.googleapis.com/v1/{message.name=spaces/*/messages/*}
URL은 gRPC 트랜스코딩 문법을 사용합니다.
경로 매개변수
매개변수 |
message.name |
string
식별자. 메시지의 리소스 이름입니다. 형식: spaces/{space}/messages/{message} 여기서 {space} 는 메시지가 게시된 스페이스의 ID이고 {message} 는 메시지의 시스템 할당 ID입니다. spaces/AAAAAAAAAAA/messages/BBBBBBBBBBB.BBBBBBBBBBB 를 예로 들 수 있습니다. 메시지를 만들 때 맞춤 ID를 설정한 경우 {message} 를 clientAssignedMessageId 필드의 값으로 대체하여 요청에서 메시지를 지정할 수 있습니다. spaces/AAAAAAAAAAA/messages/client-custom-name 를 예로 들 수 있습니다. 자세한 내용은 메일 이름 지정하기를 참고하세요.
|
쿼리 매개변수
매개변수 |
updateMask |
string (FieldMask format)
필수입니다. 업데이트할 필드 경로입니다. 쉼표로 여러 값을 구분하거나 * 를 사용하여 모든 필드 경로를 업데이트합니다. 현재 지원되는 필드 경로:
|
allowMissing |
boolean
선택사항입니다. true 및 메시지를 찾을 수 없는 경우 새 메시지가 생성되고 updateMask 은 무시됩니다. 지정된 메시지 ID는 클라이언트 할당이어야 합니다. 그렇지 않으면 요청이 실패합니다.
|
요청 본문
요청 본문에 Message
의 인스턴스가 포함됩니다.
응답 본문
성공한 경우 응답 본문에 Message
의 인스턴스가 포함됩니다.
승인 범위
다음 OAuth 범위 중 하나가 필요합니다.
https://www.googleapis.com/auth/chat.bot
https://www.googleapis.com/auth/chat.import
https://www.googleapis.com/auth/chat.messages
자세한 내용은 승인 가이드를 참고하세요.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-08-20(UTC)
[null,null,["최종 업데이트: 2025-08-20(UTC)"],[[["\u003cp\u003eUpdates a Google Chat message using the \u003ccode\u003ePATCH\u003c/code\u003e method, preferably over the \u003ccode\u003eupdate\u003c/code\u003e method which uses \u003ccode\u003ePUT\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eSupports both app and user authentication, with app authentication limited to updating messages created by the calling Chat app.\u003c/p\u003e\n"],["\u003cp\u003eRequires specifying the message to update using its resource name in the URL path and the fields to update using the \u003ccode\u003eupdateMask\u003c/code\u003e query parameter.\u003c/p\u003e\n"],["\u003cp\u003eAllows creation of a new message if the original is not found when \u003ccode\u003eallowMissing\u003c/code\u003e query parameter is set to \u003ccode\u003etrue\u003c/code\u003e and a client-assigned message ID is provided.\u003c/p\u003e\n"],["\u003cp\u003eRequires authorization with one of the specified OAuth scopes (\u003ccode\u003echat.bot\u003c/code\u003e, \u003ccode\u003echat.import\u003c/code\u003e, or \u003ccode\u003echat.messages\u003c/code\u003e).\u003c/p\u003e\n"]]],["This documentation outlines how to update a message using the `PATCH` method via an HTTP request to `https://chat.googleapis.com/v1/{message.name=spaces/*/messages/*}`. The `message.name` path parameter is required, specifying the message's resource name. The `updateMask` query parameter is mandatory, indicating which fields to update (e.g., text, attachments). Optionally, `allowMissing` creates a new message if one isn't found. The request and response bodies utilize the `Message` resource, and app or user authentication are supported, with specific authentication impacting permissions.\n"],null,["# Method: spaces.messages.patch\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nUpdates a message. There's a difference between the `patch` and `update` methods. The `patch` method uses a `patch` request while the `update` method uses a `put` request. We recommend using the `patch` method. For an example, see [Update a message](https://developers.google.com/workspace/chat/update-messages).\n\nSupports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize):\n\n- [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with the authorization scope:\n\n - `https://www.googleapis.com/auth/chat.bot`\n- [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes:\n\n - `https://www.googleapis.com/auth/chat.messages`\n - `https://www.googleapis.com/auth/chat.import` (import mode spaces only)\n\nWhen using app authentication, requests can only update messages created by the calling Chat app.\n\n### HTTP request\n\n`PATCH https://chat.googleapis.com/v1/{message.name=spaces/*/messages/*}`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `message.name` | `string` Identifier. Resource name of the message. Format: `spaces/{space}/messages/{message}` Where `{space}` is the ID of the space where the message is posted and `{message}` is a system-assigned ID for the message. For example, `spaces/AAAAAAAAAAA/messages/BBBBBBBBBBB.BBBBBBBBBBB`. If you set a custom ID when you create a message, you can use this ID to specify the message in a request by replacing `{message}` with the value from the `clientAssignedMessageId` field. For example, `spaces/AAAAAAAAAAA/messages/client-custom-name`. For details, see [Name a message](https://developers.google.com/workspace/chat/create-messages#name_a_created_message). |\n\n### Query parameters\n\n| Parameters ||\n|----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `updateMask` | `string (`[FieldMask](https://protobuf.dev/reference/protobuf/google.protobuf/#field-mask)` format)` Required. The field paths to update. Separate multiple values with commas or use `*` to update all field paths. Currently supported field paths: - `text` - `attachment` - `cards` (Requires [app authentication](/chat/api/guides/auth/service-accounts).) - `cardsV2` (Requires [app authentication](/chat/api/guides/auth/service-accounts).) - `accessoryWidgets` (Requires [app authentication](/chat/api/guides/auth/service-accounts).) - `quotedMessageMetadata` (Only allows removal of the quoted message.) |\n| `allowMissing` | `boolean` Optional. If `true` and the message isn't found, a new message is created and `updateMask` is ignored. The specified message ID must be [client-assigned](https://developers.google.com/workspace/chat/create-messages#name_a_created_message) or the request fails. |\n\n### Request body\n\nThe request body contains an instance of [Message](/workspace/chat/api/reference/rest/v1/spaces.messages#Message).\n\n### Response body\n\nIf successful, the response body contains an instance of [Message](/workspace/chat/api/reference/rest/v1/spaces.messages#Message).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/chat.bot`\n- `https://www.googleapis.com/auth/chat.import`\n- `https://www.googleapis.com/auth/chat.messages`\n\nFor more information, see the [Authorization guide](/workspace/chat/authenticate-authorize)."]]