Open API specifications

The Custom Business Logic Webhook Service allows webhooks to customize the flow of each event in a call session. Customizations include scheduling new operations, such as biometric operations, disabling nodes in the built-in flow, or setting the webhook’s own session variables.

Example of a Custom Logic Webhook based on Open API:

{
    "openapi": "3.0.2",
    "info": {
        "title": "Custom Logic Webhook API",
        "version": "1.0.0",
        "description": "Add description"
    },
    "paths": {
        "/event": {
            "summary": "Event webhook",
            "description": "Add description",
            "post": {
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Event"
                            }
                        }
                    },
                    "required": true
                },
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/CustomLogicResponse"
                    }
                }
            },
            "parameters": [
                {
                    "name": "x-request-id",
                    "description": "A unique ID for this request",
                    "schema": {
                        "type": "string"
                    },
                    "in": "header",
                    "required": false
                },
                {
                    "name": "x-call-session-id",
                    "description": "The current session ID",
                    "schema": {
                        "type": "string"
                    },
                    "in": "header",
                    "required": false
                }
            ]
        }
    },
    "components": {
        "schemas": {
            "SetSessionVariableAction": {
                "description": "Set a session variable.",
                "required": [
                    "key",
                    "value"
                ],
                "type": "object",
                "properties": {
                    "key": {
                        "description": "Required. The session variable key.",
                        "minLength": 1,
                        "type": "string"
                    },
                    "value": {
                        "description": "Required. The session variable value.",
                        "type": "string"
                    }
                }
            },
            "NodeOverrideAction": {
                "description": "Add description of the node override used",
                "required": [
                    "nodeNames"
                ],
                "type": "object",
                "properties": {
                    "nodeNames": {
                        "description": "Required. The list of node names to disable or enable.",
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "enable": {
                        "description": "Add description",
                        "type": "boolean"
                    }
                }
            },
            "CustomLogicResponse": {
                "description": "Add description",
                "required": [
                    "resultCode"
                ],
                "type": "object",
                "properties": {
                    "resultCode": {
                        "description": "Required. 200 if OK, anything else in case of an error.",
                        "type": "integer"
                    },
                    "resultMessage": {
                        "description": "Reserved for future use.",
                        "type": "string"
                    },
                    "actionsToPerform": {
                        "description": "List of operations to schedule.",
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/OperationAction"
                        }
                    },
                    "sessionVariableUpdates": {
                        "description": "Store or update a session variable. Updates are applied in the given order.",
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/SetSessionVariableAction"
                        }
                    },
                    "nodesToOverride": {
                        "description": "Update the built-in flow's node overrides. Updates are applied in the given order.",
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/NodeOverrideAction"
                        }
                    },
                    "eventFilter": {
                        "$ref": "#/components/schemas/EventFilterAction",
                        "description": "The Event filter used for the rest of the session."
                    }
                }
            },
            "Event": {
                "description": "Input message that defines parameters for /event and contains session variables for the current session.",
                "required": [
                    "sessionVariables"
                ],
                "type": "object",
                "properties": {
                    "sessionVariables": {
                        "$ref": "#/components/schemas/PathValues",
                        "description": "Session variables including the session ID, the event type, all event results collected up to this point, the current configuration, and the built-in flow's state information."
                    }
                }
            },
            "OperationAction": {
                "title": "Root Type for OperationAction",
                "description": "Schedule an operation.",
                "required": [
                    "parameters",
                    "action"
                ],
                "type": "object",
                "properties": {
                    "parameters": {
                        "$ref": "#/components/schemas/PathValues",
                        "description": "Required. The parameters."
                    },
                    "action": {
                        "description": "Required. The action to execute.",
                        "type": "string"
                    }
                }
            },
            "PathValues": {
                "title": "Root Type for PathValues",
                "type": "object",
                "additionalProperties": {
                    "type": "string"
                }
            },
            "EventFilterAction": {
                "description": "",
                "type": "object",
                "properties": {
                    "keysToIgnore": {
                        "description": "The session variable key names or patterns to ignore.",
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "valuesToIgnore": {
                        "$ref": "#/components/schemas/PathValues",
                        "description": "Session variable values to ignore."
                    },
                    "eventsToIgnore": {
                        "description": "Event types to ignore.",
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    }
                }
            }
        },
        "responses": {
            "CustomLogicResponse": {
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/CustomLogicResponse"
                        }
                    }
                },
                "description": "Add description"
            }
        }
    }
}                                                    

Event webhook

The Event webhook is invoked when an event is raised. The path shown in the code as an /event is only an example. In WebhookConfig, add any path you want.

Nodes overridden

Update the list of nodes to override in the built-in flow. The disabled nodes, identified by name, are not executed for the rest of the session unless they are enabled again. By default, all built-in flow nodes are enabled.

When the enable property is set to false, the nodes mentioned in nodeNames are disabled for the rest of the session. When set to true, the listed node names are enabled again. Default is false.

Output

Output message that defines parameters returned by /event. Every event message should have a CustomLogicResponse message, even when the message is empty.

Event filters

Event filters that are used for the rest of the session. Only events that pass all the filters are sent. By default, new sessions have no filters defined so all events are sent. The EventFilterAction includes the following parameters:

  • keysToIgnore - Session variable changes with keys defined do not trigger an Event to this webhook for the rest of the session. If a key ends with an asterisk *, all the keys starting with the prefix before the asterisk are be ignored. This special value, that is *, effectively disables the webhook for the rest of the session. An empty or undefined list removes all the filters for the rest of the session.
  • valuesToIgnore - Session variable values to ignore for the given keys. The key must accurately match the session variable key to ignore. If the value ends with an asterix *, all the values starting with the prefix before the asterisk are ignored. You can ignore multiple values for a given session variable key by separating the values with a comma (,).
  • eventsToIgnore - Values of state.currentEvent to ignore. This has higher priority than keysToIgnore and valuesToIgnore. This means that matching state.currentEvent values ignores the entire event, regardless of the contents of other session variables. If the event filter name ends with an asterisk (*), it matches all events whose name start with the prefix before the asterisk. The special value, that is * effectively disables the webhook for the rest of the session.