5G消息 JSON SCHEMA
```
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://www.gsma.com/rcs/chatbot_message_schema.json",
"title": "Root Object",
"type": "object",
"properties": {
"message": {
"type": "object",
"oneOf": [{"$ref": "#/definitions/messages/generalPurposeCardMessage"},
{"$ref": "#/definitions/messages/generalPurposeCardCarouselMessage"}]
},
"suggestions": {
"type": "array",
"items": {
"oneOf": [{"$ref": "#/definitions/suggestions/replies/reply"},
{"$ref": "#/definitions/suggestions/actions/action"}]
},
"minItems": 1,
"maxItems": 11,
"additionalItems": false
},
"response": {
"type": "object",
"oneOf": [
{"properties": {"reply": {"$ref": "#/definitions/suggestions/suggestion"}},
"required": ["reply"]},
{"properties": {"action": {"$ref": "#/definitions/suggestions/suggestion"}},
"required": ["action"]}]
},
"sharedData": {
"type": "object",
"oneOf": [{"properties": {"deviceSpecifics": {"$ref": "#/definitions/sharedData/deviceSpecifics"}}}]
}
},
"oneOf": [{"required": ["message"]},{"required": ["suggestions"]},
{"required": ["response"]},{"required": ["sharedData"]}],
"definitions": {
"messageFragments": {
"cardMedia": {
"type": "object",
"properties": {
"mediaUrl": {
"type": "string",
"format": "uri"
},
"mediaContentType": {
"type": "string"
},
"mediaFileSize": {
"type": "integer",
"minimum": 0
},
"thumbnailUrl": {
"type": "string",
"format": "uri"
},
"thumbnailContentType": {
"type": "string"
},
"thumbnailFileSize": {
"type": "integer",
"minimum": 0
},
"height": {
"type": "string",
"enum": [
"SHORT_HEIGHT",
"MEDIUM_HEIGHT",
"TALL_HEIGHT"
]
},
"contentDescription": {
"type": "string",
"minLength": 1,
"maxLength": 200
}
},
"required": [
"mediaUrl",
"mediaContentType",
"mediaFileSize",
"height"
],
"dependencies": {
"thumbnailUrl": [
"thumbnailContentType",
"thumbnailFileSize"
]
}
},
"cardTitle": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"cardDescription": {
"type": "string",
"minLength": 1,
"maxLength": 2000
},
"fontStyle": {
"type": "array",
"items": {
"type": "string",
"enum": [
"italics",
"bold",
"underline"
]
},
"minItems": 1,
"maxItems": 3,
"additionalItems": false
},
"cardStyle": {
"type": "string",
"format": "uri"
}
},
"messages": {
"generalPurposeCardMessage": {
"type": "object",
"properties": {
"generalPurposeCard": {
"type": "object",
"properties": {
"layout": {
"type": "object",
"oneOf": [
{
"properties": {
"cardOrientation": {
"type": "string",
"enum": [
"VERTICAL"
]
},
"titleFontStyle": {
"$ref": "#/definitions/messageFragments/fontStyle"
},
"descriptionFontStyle": {
"$ref": "#/definitions/messageFragments/fontStyle"
},
"style": {
"$ref": "#/definitions/messageFragments/cardStyle"
}
},
"required": [
"cardOrientation"
]
},
{
"properties": {
"cardOrientation": {
"type": "string",
"enum": [
"HORIZONTAL"
]
},
"imageAlignment": {
"type": "string",
"enum": [
"LEFT",
"RIGHT"
]
},
"titleFontStyle": {
"$ref": "#/definitions/messageFragments/fontStyle"
},
"descriptionFontStyle": {
"$ref": "#/definitions/messageFragments/fontStyle"
},
"style": {
"$ref": "#/definitions/messageFragments/cardStyle"
}
},
"required": [
"cardOrientation",
"imageAlignment"
]
}
]
},
"content": {
"type": "object",
"properties": {
"media": {
"$ref": "#/definitions/messageFragments/cardMedia"
},
"title": {
"$ref": "#/definitions/messageFragments/cardTitle"
},
"description": {
"$ref": "#/definitions/messageFragments/cardDescription"
},
"suggestions": {
"type": "array",
"items": {
"oneOf": [
{
"$ref": "#/definitions/suggestions/replies/reply"
},
{
"$ref": "#/definitions/suggestions/actions/action"
}
]
},
"minItems": 1,
"maxItems": 4,
"additionalItems": false
}
},
"anyOf": [
{
"required": ["media"]
},
{
"required": ["title"]
},
{
"required": ["description"]
}
]
}
},
"required": ["layout","content"]
}
},
"required": [
"generalPurposeCard"
]
},
"generalPurposeCardCarouselMessage": {
"type": "object",
"properties": {
"generalPurposeCardCarousel": {
"type": "object",
"properties": {
"layout": {
"type": "object",
"properties": {
"cardWidth": {
"type": "string",
"enum": ["SMALL_WIDTH","MEDIUM_WIDTH"],
"default": "SMALL_WIDTH"
},
"titleFontStyle": {
"$ref": "#/definitions/messageFragments/fontStyle"
},
"descriptionFontStyle": {"$ref": "#/definitions/messageFragments/fontStyle"},
"style": {"$ref": "#/definitions/messageFragments/cardStyle"}
},
"required": [
"cardWidth"
]
},
"content": {
"type": "array",
"items": {
"type": "object",
"properties": {
"media": {"$ref": "#/definitions/messageFragments/cardMedia"},
"title": {"$ref": "#/definitions/messageFragments/cardTitle"},
"description": {"$ref": "#/definitions/messageFragments/cardDescription"},
"suggestions": {
"type": "array",
"items": {
"oneOf": [{"$ref": "#/definitions/suggestions/replies/reply"},{"$ref": "#/definitions/suggestions/actions/action"}]
},
"minItems": 1,
"maxItems": 4,
"additionalItems": false
}
},
"anyOf": [{"required": ["media"]},{"required": ["title"]},{"required": ["description"]}]
},
"minItems": 2,
"maxItems": 12,
"additionalItems": false
}
},
"required": ["layout","content"]
}
},
"required": ["generalPurposeCardCarousel"]
}
},
"suggestionFragments": {
"postback": {
"type": "object",
"properties": {
"data": {
"type": "string",
"maxLength": 2048
}
},
"required": [
"data"
]
}
},
"suggestions": {
"suggestion": {
"title": "Common base definition for suggested replies and suggested actions.",
"type": "object",
"properties": {
"displayText": {
"type": "string",
"minLength": 1,
"maxLength": 25
},
"postback": {
"$ref": "#/definitions/suggestionFragments/postback"
}
},
"required": [
"displayText"
]
},
"replies": {
"reply": {
"title": "Definition of a suggested reply.",
"type": "object",
"properties": {
"reply": {
"allOf": [
{
"$ref": "#/definitions/suggestions/suggestion"
}
]
}
},
"required": [
"reply"
]
}
},
"actions": {
"action": {
"title": "Common base definition of a suggested action.",
"type": "object",
"properties": {
"action": {
"type": "object",
"allOf": [
{
"$ref": "#/definitions/suggestions/suggestion"
},
{
"oneOf": [
{
"$ref": "#/definitions/suggestions/actions/urlAction"
},
{
"$ref": "#/definitions/suggestions/actions/dialerAction"
},
{
"$ref": "#/definitions/suggestions/actions/mapAction"
},
{
"$ref": "#/definitions/suggestions/actions/calendarAction"
},
{
"$ref": "#/definitions/suggestions/actions/composeAction"
},
{
"$ref": "#/definitions/suggestions/actions/deviceAction"
},
{
"$ref": "#/definitions/suggestions/actions/settingsAction"
}
]
}
]
}
},
"required": [
"action"
]
},
"urlAction": {
"title": "Suggested actions to interact a website or deep app link.",
"properties": {
"urlAction": {
"type": "object",
"oneOf": [
{
"properties": {
"openUrl": {
"type": "object",
"oneOf": [
{
"properties": {
"url": {
"type": "string",
"format": "uri"
},
"application": {
"type": "string",
"enum": [
"browser"
]
}
},
"required": [
"url",
"application"
]
},
{
"properties": {
"url": {
"type": "string",
"format": "uri"
},
"application": {
"type": "string",
"enum": [
"webview"
]
},
"viewMode": {
"type": "string",
"enum": [
"full",
"half",
"tall"
]
},
"parameters": {
"type": "string",
"minLength": 1,
"maxLength": 200
}
},
"required": [
"url",
"application"
]
}
]
}
},
"required": [
"openUrl"
]
}
]
}
},
"required": [
"urlAction"
]
},
"dialerAction": {
"title": "Suggested actions for interacting with a phone number.",
"properties": {
"dialerAction": {
"type": "object",
"oneOf": [
{
"properties": {
"dialPhoneNumber": {
"type": "object",
"properties": {
"phoneNumber": {
"type": "string"
},
"fallbackUrl": {
"type": "string",
"format": "uri"
}
},
"required": [
"phoneNumber"
]
}
},
"required": [
"dialPhoneNumber"
]
},
{
"properties": {
"dialEnrichedCall": {
"type": "object",
"properties": {
"phoneNumber": {
"type": "string"
},
"subject": {
"type": "string",
"maxLength": 60
},
"fallbackUrl": {
"type": "string",
"format": "uri"
}
},
"required": [
"phoneNumber"
]
}
},
"required": [
"dialEnrichedCall"
]
},
{
"properties": {
"dialVideoCall": {
"type": "object",
"properties": {
"phoneNumber": {
"type": "string"
},
"fallbackUrl": {
"type": "string",
"format": "uri"
}
},
"required": [
"phoneNumber"
]
}
},
"required": [
"dialVideoCall"
]
}
]
}
},
"required": [
"dialerAction"
]
},
"mapAction": {
"title": "Suggested actions for interacting with a location on a map.",
"properties": {
"mapAction": {
"type": "object",
"oneOf": [
{
"properties": {
"showLocation": {
"title": "Shows a given location on a map.",
"type": "object",
"properties": {
"location": {
"type": "object",
"properties": {
"latitude": {
"type": "number"
},
"longitude": {
"type": "number"
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"query": {
"title": "Search for location(s) by query",
"description": "Search is based on user's current location",
"examples": [
"restaurants",
"GSMA Head Office, 25 Walbrook, London, UK"
],
"type": "string",
"minLength": 1,
"maxLength": 200
}
},
"oneOf": [
{
"required": [
"latitude",
"longitude"
]
},
{
"required": [
"query"
]
}
]
},
"fallbackUrl": {
"type": "string",
"format": "uri"
}
},
"required": [
"location"
]
}
},
"required": [
"showLocation"
]
},
{
"properties": {
"requestLocationPush": {
"title": "One-time request to send a geo location push from UE to chatbot",
"type": "object"
}
},
"required": [
"requestLocationPush"
]
}
]
}
},
"required": [
"mapAction"
]
},
"calendarAction": {
"title": "Suggested actions for interacting with a calendar event.",
"properties": {
"calendarAction": {
"type": "object",
"oneOf": [
{
"properties": {
"createCalendarEvent": {
"type": "object",
"properties": {
"startTime": {
"type": "string",
"format": "date-time"
},
"endTime": {
"type": "string",
"format": "date-time"
},
"title": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"description": {
"type": "string",
"minLength": 1,
"maxLength": 500
},
"fallbackUrl": {
"type": "string",
"format": "uri"
}
},
"required": [
"startTime",
"endTime",
"title"
]
}
},
"required": [
"createCalendarEvent"
]
}
]
}
},
"required": [
"calendarAction"
]
},
"composeAction": {
"title": "Suggested actions for composing draft messages.",
"properties": {
"composeAction": {
"type": "object",
"oneOf": [
{
"properties": {
"composeTextMessage": {
"title": "Compose a draft text message.",
"type": "object",
"properties": {
"phoneNumber": {
"type": "string"
},
"text": {
"type": "string",
"maxLength": 100
}
},
"required": [
"phoneNumber",
"text"
]
}
},
"required": [
"composeTextMessage"
]
},
{
"properties": {
"composeRecordingMessage": {
"title": "Compose a draft message with a media recording.",
"type": "object",
"properties": {
"phoneNumber": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"AUDIO",
"VIDEO"
]
}
},
"required": [
"phoneNumber",
"type"
]
}
},
"required": [
"composeRecordingMessage"
]
}
]
}
},
"required": [
"composeAction"
]
},
"deviceAction": {
"title": "Suggested actions for interacting with the user's device.",
"properties": {
"deviceAction": {
"type": "object",
"oneOf": [
{
"properties": {
"requestDeviceSpecifics": {
"title": "Request specifics about the user's device.",
"type": "object"
}
},
"required": [
"requestDeviceSpecifics"
]
}
]
}
},
"required": [
"deviceAction"
]
},
"settingsAction": {
"title": "Suggested actions for interacting with app settings",
"properties": {
"settingsAction": {
"type": "object",
"oneOf": [
{
"properties": {
"disableAnonymization": {
"title": "Ask the user to disable the anonymization setting.",
"type": "object"
}
},
"required": [
"disableAnonymization"
]
},
{
"properties": {
"enableDisplayedNotifications": {
"title": "Ask the user to enable sending displayed notifications.",
"type": "object"
}
},
"required": [
"enableDisplayedNotifications"
]
}
]
}
},
"required": [
"settingsAction"
]
}
}
},
"sharedData": {
"deviceSpecifics": {
"title": "Device specifics shared by the client with the chatbot platform.",
"type": "object",
"properties": {
"deviceModel": {
"title": "Short description of the device model.",
"type": "string",
"minLength": 1,
"maxLength": 10
},
"platformVersion": {
"title": "Version information about the operating system on the device .",
"type": "string",
"minLength": 1,
"maxLength": 20
},
"clientVendor": {
"title": "Short code for client vendor, same as used during RCS autoconfiguration.",
"type": "string",
"minLength": 1,
"maxLength": 4
},
"clientVersion": {
"title": "Version information about the client, same as used during RCS autoconfiguration ",
"type": "string",
"minLength": 1,
"maxLength": 15
},
"batteryRemainingMinutes": {
"title": "Remaining battery use of device in minutes",
"type": "integer",
"minimum": 0
}
}
}
}
}
}
```