- Print
- DarkLight
- PDF
Waiting for Callback node pauses the processing of a task until it receives a response. It is great for cases when a process must wait for action from a user. For example, a chatbot will wait for user input before it will generate a reply (see Picture 1).
Picture 1. Waiting for Callback node task flow
Waiting for Callback is similar to Set State in that once a task gets into it, it cannot move on until it is modified in some way(or until it expires). However, unlike Set State, there are no conditions to be met. As soon as a task is modified, it will exit the node, no matter the change.
There are several ways to callback a task:
- Manually from View Mode
- Modify Task node
- Corezoid API
- Request to Callback URL
Corezoid API is a framework that allows you to do any operation you can do in the UI through code. There is a specific format it must follow. See Corezoid API documentation for more details.
Request to Callback URL is the API request made specifically to the URL provided within the Waiting for Callback node. This is the recommended method for replying to tasks from outside Corezoid.
Node Settings
API Callback URL
Corezoid - Callback URL for an API call.
Mandrill - Legacy feature. A Callback URL that allows you to receive callbacks directly from Mandrill.
Path to task ID - If you are using the Callback URL option, you will have to specify the task ID of the task you are replying to as one of the parameters of the API Call. You should state that parameter here.
Other
Synchronous - (enabled by default) with this option is enabled, when updating a task from an external system using a request to Callback URL and the task isn't in the current node, you'll get the task_not_in_current_sync_callback_node error.
With the Synchronous option disabled, the request will be successful even if the task isn't in the current node.
Alert if the number of tasks in the node queue reaches the following number - a condition that will be met when the node has a specified number of tasks in it. If this option is selected, a new edge will be created.
Maximum interval, for which the task stays in the node before being forwarded - the amount of time a task must spend in this node. Can be specified in seconds, minutes, hours, or days.
Examples
Manually
To modify a task from the interface:
- Switch to View mode.
- Press + New task.
- Select Modify, enter task reference and new parameters.
- Click on Add task (see Picture 2).
Picture 2. Modifying a task in a Waiting for Callback node in the View mode
Pro tip: There is a Modify button in the task window that is available in the Archive tab that will open and prepare the New Task panel for you (see Picture 3).
Picture 3. "Modify" button in the task menu of a Waiting for Callback node in the View mode
Modify Task node
You can also modify a task within the Waiting for Callback node from a Modify Task node in a different process. It works exactly in the same way as it does with the Set State node (see Picture 4).
Picture 4. Specifying a process in a Modify Task node to modify a task in a Waiting for Callback node of the specified process
Corezoid API
Like any other action in Corezoid, you can use the Corezoid API to modify a task within Waiting for Callback.
You can use this request body for your requests:
{
"ops": [
{
"type": "modify",
"obj": "task",
"ref": "test_ref",
"conv_id": "259715",
"data": {
"new_param": "test"
}
}]}
Callback URL
You can modify a task by submitting a POST request to the URL provided within the Waiting for Callback node itself.
You will need to provide a request body. It must include a parameter that specifies the task ID. You can specify the parameter name within the Waiting for Callback node in the Path to task ID field.
Example of the request in Postman (Picture 5):
Picture 5. Sending a request in Postman to modify a task within the Waiting for Callback node
Error handling & troubleshooting
When an error occurs in the node, the following fields are added to the initial task depending on the error and node type:
Error parameter name | Parameter description |
---|---|
__conveyor_node_type_return_type_error__ | Error type: hardware (system error), software (error in a node logic/settings) |
__conveyor_node_type_return_type_tag__ | Error tag (see the *-marked errors in Error tag column of the table below) |
__conveyor_node_type_return_type_description__ | Error description in human-readable language. Can be static or dynamic |
Problem/Error tag | Cause | Solution |
---|---|---|
*"task_not_in_current_sync_callback_node" error | The task you are trying to modify from a Modify State node is not within a referred Waiting for Callback node | Make sure the task is in the specified node at the moment or uncheck the Synchronous box in the Waiting for Callback node settings. |
*the node errors that are listed with the exact error tag (conveyor_node name_return_type_tag).
For more information on errors that may occur when modifying tasks in a Waiting for Callback node, please refer to the Error handling & troubleshooting section of the Modify Task article.