Custom logic webhooks
CustomBusinessLogic
The Custom Business Logic Webhook Service allows webhooks to customize the flow for each event in a call session. Customization includes scheduling new operations (biometric operations and so on), disabling nodes in the built-in flow, or setting the webhook’s own session variables.
CustomBusinessLogic gRPC method definitions
The following table describes the event handler:
| Method Name | Request Type | Response Type | Description |
|---|---|---|---|
| OnEvent | Event | CustomLogicResponse | Invoked when an event is raised. |
CustomLogicResponse
Output message that defines parameters returned by OnEvent. Every Event message should have a CustomLogicResponse message, even when the message is empty (meaning that the result_code is “200” and nothing else is set).
The following table describes CustomLogicResponse message:
| Field | Type | Description |
|---|---|---|
| result_code | int32 | Required. Contains the error code. Value is 200 if no error occurred. |
| result_message | string | Reserved for future use. |
| actions_to_perform | OperationAction | List of operations to schedule. |
| session_variable_updates | SetSessionVariableAction | Instructs the system to store or update a session variable. Updates are applied in the given order. |
| nodes_to_override | NodeOverrideAction | Instructs the system to update the built-in flow’s node overrides. Updates are applied in the given order. |
| event_filter | EventFilterAction | Event filter that the system uses for the rest of the session. |
Event
Input message that defines parameters for OnEvent and contains session variables for the current session.
The following table describes the event object definition:
| Field | Type | Description |
|---|---|---|
| session_variables | Event.SessionVariablesEntry | 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. |
Event.SessionVariablesEntry
Key and value of the session variable.
The following table describes the key and value of the session variable:
| Field | Type | Description |
|---|---|---|
| key | string | Required. Session variable key. |
| value | string | Required. Session variable value. |
EventFilterAction
Event filters that the system uses for the rest of the session. Only events that pass all the filters is sent. By default, new sessions have no filters defined so all events is sent.
Before sending an event, a delta of the session variables between the previous event and the current one is computed. This delta is the list of keys that were added since the previous event, or whose value was modified. If all the keys of the delta are in keys_to_ignore, then the event is filtered and not sent to the webhook.
Some session variables that are often updated automatically are excluded from that delta by default.
If the filter keys ends with an asterisk “*”, then it matches all the keys in the delta whose name start with that prefix (before the “*”). The special value “*” effectively disables the webhook for the rest of the session.
Values of “state.currentEvent” to ignore. The events_to_ignore parameter has higher priority than the keys_to_ignore parameter. This means that matching “state.currentEvent” values ignores the entire event, regardless of the contents of other session variables.
The following table describes the EventFilterAction parameters:
| Field | Type | Description |
|---|---|---|
| keys_to_ignore | string | The session variable key names or patterns to ignore. |
| values_to_ignore | EventFilterAction.ValuesToIgnoreEntry | The session variable values to ignore. Not currently supported. |
| events_to_ignore | string | Event types to ignore. |
EventFilterAction.ValuesToIgnoreEntry
Session variable values to ignore. Not currently supported.
The following table describes the session variable values to ignore:
| Field | Type | Description |
|---|---|---|
| key | string | Key to ignore. |
| value | string | Value to ignore. |
NodeOverrideAction
Update the list of Nodes to override in the built-in flow. The disabled nodes, identified by name, do not execute for the rest of the session unless enabled again. By default, all built-in flow nodes are enabled.
The following table describes the NodeOverrideAction parameters:
| Field | Type | Description |
|---|---|---|
| node_names | string | Required. The list of node names to disable or enable. |
| enable | bool | When set to false, the nodes mentioned in node_names are disabled for the rest of the session. When set to true, the listed node names are enabled again. |
OperationAction
Schedule an operation.
The following table describes the OperationAction parameters:
| Field | Type | Description |
|---|---|---|
| action | string | Required. The action to execute. |
| parameters | OperationAction.ParametersEntry | Required. The parameters to use when executing an operation. |
OperationAction.ParametersEntry
Parameters used when executing a scheduled operation.
The following table describes the list of parameters used when executing a scheduled operation:
| Field | Type | Description |
|---|---|---|
| key | string | Required. Parameter key. |
| value | string | Required. Parameter value. |
SetSessionVariableAction
Set a session variable.
The following table describes the list of parameters used to set a session variable:
| Field | Type | Description |
|---|---|---|
| key | string | Required. The session variable key. |
| value | string | Required. The session variable value. |