92 lines
2.0 KiB
JSON
92 lines
2.0 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://crm.local/contracts/omni-inbound-envelope.v1.json",
|
|
"title": "OmniInboundEnvelopeV1",
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"version",
|
|
"idempotencyKey",
|
|
"provider",
|
|
"channel",
|
|
"direction",
|
|
"providerEventId",
|
|
"providerMessageId",
|
|
"eventType",
|
|
"occurredAt",
|
|
"receivedAt",
|
|
"payloadRaw",
|
|
"payloadNormalized"
|
|
],
|
|
"properties": {
|
|
"version": {
|
|
"const": 1
|
|
},
|
|
"idempotencyKey": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 512
|
|
},
|
|
"provider": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 64
|
|
},
|
|
"channel": {
|
|
"type": "string",
|
|
"enum": ["TELEGRAM", "WHATSAPP", "INSTAGRAM", "PHONE", "EMAIL", "INTERNAL"]
|
|
},
|
|
"direction": {
|
|
"const": "IN"
|
|
},
|
|
"providerEventId": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 256
|
|
},
|
|
"providerMessageId": {
|
|
"type": ["string", "null"],
|
|
"maxLength": 256
|
|
},
|
|
"eventType": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 128
|
|
},
|
|
"occurredAt": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
},
|
|
"receivedAt": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
},
|
|
"payloadRaw": {
|
|
"type": ["object", "array", "string", "number", "boolean", "null"]
|
|
},
|
|
"payloadNormalized": {
|
|
"type": "object",
|
|
"additionalProperties": true,
|
|
"required": ["threadExternalId", "contactExternalId", "text", "businessConnectionId"],
|
|
"properties": {
|
|
"threadExternalId": {
|
|
"type": ["string", "null"],
|
|
"maxLength": 256
|
|
},
|
|
"contactExternalId": {
|
|
"type": ["string", "null"],
|
|
"maxLength": 256
|
|
},
|
|
"text": {
|
|
"type": ["string", "null"],
|
|
"maxLength": 4096
|
|
},
|
|
"businessConnectionId": {
|
|
"type": ["string", "null"],
|
|
"maxLength": 256
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|