AbstractAbstractcreateCreates a persistent callback to a method on the current class.
The function to callback
Additional arguments to pass to the function (must be serializable)
Promise resolving to a persistent callback token
AbstractcreateCreates a persistent callback to a function from the parent twist/tool. Use this when the callback function is passed in from outside this class.
The function to callback
Additional arguments to pass to the function (must be serializable, validated at runtime)
Promise resolving to a persistent callback token
AbstractdeleteDeletes a specific callback by its token.
The callback token to delete
Promise that resolves when the callback is deleted
AbstractdeleteDeletes all callbacks for the tool's parent.
Promise that resolves when all callbacks are deleted
Abstractrun
Built-in tool for creating and managing persistent callback references.
The Callbacks tool enables twists and tools to create callback links that persist across worker invocations and restarts. This is essential for webhook handlers, scheduled operations, and user interaction flows that need to survive runtime boundaries.
Note: Callback methods are also available directly on Twist and Tool classes via
this.callback(),this.deleteCallback(),this.deleteAllCallbacks(), andthis.run(). This is the recommended approach for most use cases.When to use callbacks:
Type Safety: Callbacks are fully type-safe - extraArgs are type-checked against the function signature.
Example