Google Business Messages 功能將於 2024 年 7 月 31 日終止服務。請按
這裡瞭解詳情。
Context
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
JSON 表示法 |
{
"entryPoint": enum (EntryPoint ),
"userInfo": {
object (UserInfo )
},
"widget": {
object (Widget )
},
"resolvedLocale": string,
"customContext": string,
// Union field place can be only one of the following:
"placeId": string,
"nearPlaceId": string
// End of list of possible types for union field place .
} |
欄位 |
entryPoint |
enum (EntryPoint )
使用者點選的進入點。
|
userInfo |
object (UserInfo )
撰寫訊息的使用者身分。
|
widget |
object (Widget )
用於開啟對話的小工具相關資訊。
|
resolvedLocale |
string
已解析語言代碼。根據位置、可能的語言偏好和其他因素,比對使用者和支援的服務專員地區。語言代碼值是格式正確的 IETF BCP 47 語言代碼。
|
customContext |
string
合作夥伴指定的背景資訊。
|
聯集欄位 place 。可設定 placeId 或 nearPlaceId。place 只能是下列其中一項: |
placeId |
string
地點的地點 ID,或是 Google 地點介面當中的專屬 ID。
|
nearPlaceId |
string
地點 ID,或是 Google 地點介面集內使用的專屬 ID,也就是距離使用者最近的位置。
|
UserInfo
JSON 表示法 |
{
"displayName": string,
"userDeviceLocale": string
} |
欄位 |
displayName |
string
使用者的顯示名稱。
|
userDeviceLocale |
string
使用者的語言代碼。由裝置語言設定決定。
|
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[[["\u003cp\u003eContextual data provides information about the user, entry point, widget, locale, and custom data associated with a message.\u003c/p\u003e\n"],["\u003cp\u003eUser info includes the user's display name and device locale.\u003c/p\u003e\n"],["\u003cp\u003eWidget details encompass the URL and context string of the widget used to initiate the conversation.\u003c/p\u003e\n"],["\u003cp\u003eResolved locale represents a match between user and agent locales based on location and language preferences.\u003c/p\u003e\n"],["\u003cp\u003eCustom and location context can be included as strings or Place IDs respectively, to provide additional data.\u003c/p\u003e\n"]]],[],null,["# Contextual data associated with a message.\n\n| JSON representation |\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"entryPoint\": enum (/business-communications/business-messages/reference/rest/v1/EntryPoint), \"userInfo\": { object (/business-communications/business-messages/reference/rest/v1/Context#UserInfo) }, \"widget\": { object (/business-communications/business-messages/reference/rest/v1/Context#Widget) }, \"resolvedLocale\": string, \"customContext\": string, // Union field `place` can be only one of the following: \"placeId\": string, \"nearPlaceId\": string // End of list of possible types for union field `place`. } ``` |\n\n| Fields ||\n|------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `entryPoint` | `enum (`[EntryPoint](/business-communications/business-messages/reference/rest/v1/EntryPoint)`)` The entry point that the user clicked. |\n| `userInfo` | `object (`[UserInfo](/business-communications/business-messages/reference/rest/v1/Context#UserInfo)`)` Identity of the user who wrote the message. |\n| `widget` | `object (`[Widget](/business-communications/business-messages/reference/rest/v1/Context#Widget)`)` Information about the widget used to start the conversation. |\n| `resolvedLocale` | `string` Resolved locale. A match of user and supported agent locales based on location, likely language preference, and other factors. The locale value is a well-formed [IETF BCP 47](https://tools.ietf.org/html/bcp47) language tag. |\n| `customContext` | `string` Context data specified by the partner. |\n| Union field `place`. Either placeId or nearPlaceId can be set. `place` can be only one of the following: ||\n| `placeId` | `string` The [Place ID](https://developers.google.com/places/place-id), or unique identifier used in Google Places, for the location. |\n| `nearPlaceId` | `string` The [Place ID](https://developers.google.com/places/place-id), or unique identifier used in Google Places, of the nearest location to the user. |\n\nUserInfo\n--------\n\nUser identity data associated with a message.\n\n| JSON representation |\n|---------------------------------------------------------------|\n| ``` { \"displayName\": string, \"userDeviceLocale\": string } ``` |\n\n| Fields ||\n|--------------------|-----------------------------------------------------------------------|\n| `displayName` | `string` User's display name. |\n| `userDeviceLocale` | `string` User's locale. Determined by the device's language settings. |\n\nWidget\n------\n\nWidget information associated with a message.\n\n| JSON representation |\n|----------------------------------------------------|\n| ``` { \"url\": string, \"widgetContext\": string } ``` |\n\n| Fields ||\n|-----------------|-------------------------------------------------------------------------------------------------------------------|\n| `url` | `string` URL where the widget was integrated. |\n| `widgetContext` | `string` Context string associated with the widget. Specified by the widget's `data-bm-widget-context` attribute. |"]]