{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://cpobjects.mycpl.net/schema/message.json", "$dynamicAnchor": "message", "title": "Message", "description": "Message", "type": "object", "properties": { "token": { "description": "Unique ID of the message", "type": "string" }, "provider_relations": { "description": "Array of unique IDs of the message in another providers", "type": "array", "items": { "type": "object", "$ref": "./provider_relation.json" } }, "channel": { "type": "object", "$ref": "./channel.json" }, "thread": { "type": "object", "$ref": "./message_thread.json" }, "sender": { "description": "Channel subscriber who sends the message", "type": "object", "$ref": "./channel_subscriber.json" }, "sent_from": { "description": "Application which sends the message", "type": "object", "$ref": "./cgc/application.json" }, "reply_to": { "description": "Message which is replied", "$dynamicRef": "#message" }, "status": { "description": "Status of the message", "type": "string", "enum": [ "sent", "delivered", "read", "error" ] }, "feedback": { "description": "Feedback of the message", "type": "string", "enum": [ "positive", "negative", "neutral" ] }, "created_at": { "description": "Date-Time of create", "$ref": "./definitions/date_time.json" }, "updated_at": { "description": "Date-Time of update", "$ref": "./definitions/date_time.json" }, "content": { "description": "Content of the message", "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "const": "text" }, "text": { "type": "string", "description": "Text content of the message" } }, "required": [ "type", "text" ] }, { "type": "object", "properties": { "type": { "const": "product_offer" }, "product_offer": { "type": "object", "$ref": "./message/product_offer.json" } }, "required": [ "type", "product_offer" ] }, { "type": "object", "properties": { "type": { "const":"file" }, "file": { "type": "object", "$ref": "./message/file.json" } }, "required": [ "type", "file" ] }, { "type": "object", "properties": { "type": { "const":"task" }, "task": { "type": "object", "$ref": "./message/task.json" } }, "required": [ "type", "task" ] } ] }, "minItems": 1 } }, "required": [ "token", "content" ] }