POST · Valider
Rédigé par Red Blue
Mis à jour le
POST /api/v1/workflows/validate
operationId : workflow_validate
Accès | Permission | Consentements OAuth |
|---|---|---|
OAuth : délégation d’un équipier pour l’API | workflow.update | api:connect, workflow:write |
KHONY_ORIGIN est l’origine HTTPS de votre application Khony, sans chemin final. Remplacez les identifiants de l’exemple par ceux de vos ressources autorisées. Les données de réponse ci-dessous illustrent le format ; elles ne sont pas le résultat d’un appel à votre organisation.
Champs du corps JSON
Nom | Emplacement | Requis | Type et contraintes |
|---|---|---|---|
productId | JSON | Oui | string |
document | JSON | Oui | object |
Exemple de requête
curl --request POST "$KHONY_ORIGIN/api/v1/workflows/validate" \
--header "Authorization: Bearer $KHONY_ACCESS_TOKEN" \
--header 'Content-Type: application/json' \
--data-raw '{
"productId": "product_01k3w8d7vhe008000000000001",
"document": {
"schemaVersion": 1,
"trigger": {
"id": "trigger",
"event": "feedback-created",
"version": 1,
"config": {
"channels": [
"widget"
],
"audience": "everyone",
"hours": "always",
"extra": {}
}
},
"blocks": [
{
"id": "wait-block",
"label": "Follow up",
"steps": [
{
"id": "wait-step",
"kind": "wait",
"version": 1,
"config": {
"until": "1h",
"interrupt": false
}
}
]
}
],
"edges": [
{
"id": "next",
"source": "trigger",
"port": "next",
"target": "wait-block"
}
]
}
}'Réponse de succès · HTTP 200
{
"valid": true,
"issues": []
}Schéma complet du corps JSON
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"productId": {
"type": "string",
"pattern": "^product_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
},
"document": {
"type": "object",
"properties": {
"schemaVersion": {
"type": "number",
"const": 1
},
"trigger": {
"type": "object",
"properties": {
"id": {
"$ref": "#/$defs/__schema0"
},
"event": {
"type": "string",
"enum": [
"messenger-open",
"first-message",
"any-message",
"page-visit",
"customer-silent",
"team-silent",
"state-change",
"ticket-created",
"feedback-created",
"idea-vote",
"idea-threshold",
"idea-status",
"csat-received",
"incident",
"revenue-change",
"schedule"
]
},
"version": {
"type": "integer",
"minimum": 1,
"maximum": 100
},
"config": {
"$ref": "#/$defs/__schema1"
}
},
"required": [
"id",
"event",
"version",
"config"
],
"additionalProperties": false
},
"blocks": {
"maxItems": 100,
"type": "array",
"items": {
"$ref": "#/$defs/__schema3"
}
},
"edges": {
"maxItems": 150,
"type": "array",
"items": {
"$ref": "#/$defs/__schema5"
}
}
},
"required": [
"schemaVersion",
"trigger",
"blocks",
"edges"
],
"additionalProperties": false
}
},
"required": [
"productId",
"document"
],
"additionalProperties": false,
"$defs": {
"__schema0": {
"type": "string",
"minLength": 1,
"maxLength": 160
},
"__schema1": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"$ref": "#/$defs/__schema2"
}
},
"__schema2": {
"anyOf": [
{
"type": [
"string",
"number",
"boolean",
"null"
]
},
{
"type": "array",
"items": {
"$ref": "#/$defs/__schema2"
}
},
{
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"$ref": "#/$defs/__schema2"
}
}
]
},
"__schema3": {
"type": "object",
"properties": {
"id": {
"$ref": "#/$defs/__schema0"
},
"label": {
"type": "string",
"maxLength": 160
},
"steps": {
"maxItems": 30,
"type": "array",
"items": {
"$ref": "#/$defs/__schema4"
}
}
},
"required": [
"id",
"label",
"steps"
],
"additionalProperties": false
},
"__schema4": {
"type": "object",
"properties": {
"id": {
"$ref": "#/$defs/__schema0"
},
"kind": {
"type": "string",
"enum": [
"agent",
"custom_action",
"message",
"eta",
"notify-voters",
"buttons",
"collect",
"csat",
"await-reply",
"block-typing",
"assign",
"note",
"tag",
"priority",
"to-ticket",
"typed-ticket",
"ticket-state",
"close",
"tag-contact",
"sla",
"attribute",
"rules",
"ai-task",
"link-idea",
"create-idea",
"idea-status",
"follow-idea",
"slack",
"email-team",
"email-customer",
"issue",
"wait",
"snooze",
"conditions",
"triage",
"approval"
]
},
"version": {
"type": "integer",
"minimum": 1,
"maximum": 100
},
"config": {
"$ref": "#/$defs/__schema1"
}
},
"required": [
"id",
"kind",
"version",
"config"
],
"additionalProperties": false
},
"__schema5": {
"type": "object",
"properties": {
"id": {
"$ref": "#/$defs/__schema0"
},
"source": {
"$ref": "#/$defs/__schema0"
},
"port": {
"$ref": "#/$defs/__schema0"
},
"target": {
"$ref": "#/$defs/__schema0"
}
},
"required": [
"id",
"source",
"port",
"target"
],
"additionalProperties": false
}
}
}Schéma complet de la réponse
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"valid": {
"type": "boolean"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"severity": {
"type": "string",
"enum": [
"error",
"warning"
]
},
"path": {
"type": "array",
"items": {
"type": [
"string",
"number"
]
}
},
"canonicalPath": {
"type": "array",
"items": {
"type": [
"string",
"number"
]
}
},
"message": {
"type": "string"
},
"edgeId": {
"type": "string"
},
"port": {
"type": "string"
},
"nodeId": {
"type": "string"
},
"stepId": {
"type": "string"
},
"kind": {
"type": "string"
}
},
"required": [
"code"
],
"additionalProperties": false
}
}
},
"required": [
"valid",
"issues"
],
"additionalProperties": false
}Refus et reprise
Les statuts documentés pour cette opération sont 400, 401, 402, 403, 404, 409, 428, 429, 500, 503. Identifiez la cause avec error.code et, lorsqu’il est présent, error.reason. Une réponse 409 peut demander une relecture de révision ou signaler une commande incompatible ; une réponse 428 demande une confirmation humaine. Ne rejouez une écriture que selon son contrat.
Notes du contrat
{
"description": "Requires a dedicated API OAuth bearer for audience /api/v1, api:connect and the stated workflow scope, current organization/product consent and native human permissions. Organization keys and cookies are not accepted. Every admission consumes a product API request; native write billing checks apply. Validates the real Explorer production registry, resource relationships and canonical compiler. No effect or publication occurs."
}