我们将于 2024 年 7 月 31 日逐步淘汰 Google Business Messages。点击
此处了解详情。
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 )
用于发起对话的 widget 的相关信息。
|
resolvedLocale |
string
已解析的语言区域。根据位置、可能的语言偏好和其他因素,匹配用户和支持的代理语言区域。语言区域值是格式正确的 IETF BCP 47 语言标记。
|
customContext |
string
合作伙伴指定的上下文数据。
|
联合字段 place 。可以设置 placeId 或 nearPlaceId。place 只能是下列其中一项: |
placeId |
string
营业地点的地点 ID 或 Google 商家信息中使用的唯一标识符。
|
nearPlaceId |
string
距离用户最近的营业地点的地点 ID 或 Google 商家信息中使用的唯一标识符。
|
UserInfo
JSON 表示法 |
{
"displayName": string,
"userDeviceLocale": string
} |
字段 |
displayName |
string
用户的显示名称。
|
userDeviceLocale |
string
用户的语言区域。取决于设备的语言设置。
|
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):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. |"]]