ByteChef LogoByteChef
Component Specification

Trigger

The trigger definition is used to specify the properties of a trigger. Below is an explanation of each method that can be used in the trigger definition:

  • trigger(String name) - Builds new ModifiableTriggerDefinition with the specified name. The name defines the trigger key (backend ID).
  • description(String description) - Provides a short description of the trigger.
  • output - Defines the output of the trigger.
  • properties(P... properties) - Lists the properties that the trigger needs to perform its task. Properties will be shown in the Properties tab. For more information, refer to the Property.
  • title(String title) - Sets the name of the trigger that will be displayed in the UI. Use Chicago Style.
  • type(TriggerType type) - Sets the type of the trigger. Possible types are CALLABLE, DYNAMIC_WEBHOOK, HYBRID, LISTENER, POLLING, STATIC_WEBHOOK and WEBSOCKET.
  • poll(PollFunction poll) - Required for POLLING triggers. This method is called at specified intervals to check for new data.
  • webhookEnable(WebhookEnableFunction webhookEnable) - Required for DYNAMIC_WEBHOOK triggers. This method is called when the trigger is enabled to register the webhook with the third-party service.
  • webhookDisable(WebhookDisableConsumer webhookDisable) - Required for DYNAMIC_WEBHOOK triggers. This method is called when the trigger is disabled to unregister the webhook from the third-party service.
  • webhookRequest(WebhookRequestFunction webhookRequest) - Required for DYNAMIC_WEBHOOK and STATIC_WEBHOOK triggers. This method is called when a webhook request is received to process the incoming data.
  • listenerEnable(ListenerEnableConsumer listenerEnable) - Required for LISTENER triggers. This method is called when the trigger is enabled to start listening for events.
  • listenerDisable(ListenerDisableConsumer listenerDisable) - Required for LISTENER triggers. This method is called when the trigger is disabled to stop listening for events.
  • webhookValidate(WebhookValidateFunction webhookValidate) - Optional for webhook triggers. Used to validate the incoming webhook request (e.g., checking signatures) before a job is created.
  • webhookValidateOnEnable(WebhookValidateFunction webhookValidateOnEnable) - Optional. Validates the request during the provider's URL-verification handshake performed at enable time (e.g., echoing back a challenge token).
  • webhookRawBody(boolean webhookRawBody) - When true, the raw request body is passed to webhookRequest without being parsed (needed for signature verification over the exact bytes).
  • workflowSyncExecution(boolean workflowSyncExecution) - When true, the workflow runs synchronously and the HTTP caller receives the workflow's response (used by request-response webhook patterns).
  • batch(boolean batch) - When true and the trigger output is a list, a single job runs with the whole list; when false, one job runs per list element.
  • deduplicate(DeduplicateFunction deduplicate) - Optional for polling triggers. Provides a key used to drop records that were already seen on a previous poll.
  • dynamicWebhookRefresh(DynamicWebhookRefreshFunction dynamicWebhookRefresh) - Optional for DYNAMIC_WEBHOOK triggers whose registration expires. Called before expiration to renew the webhook and return a fresh output.

Trigger Type

  • CALLABLE: A trigger that has no inbound endpoint of its own - the workflow is invoked directly, by another workflow or by a caller that holds a reference to it. workflow/v1/newWorkflowCall is the built-in example, and it is also the trigger that makes a workflow exposable as an MCP or A2A tool.
  • DYNAMIC_WEBHOOK: A trigger that listens for incoming HTTP requests at a dynamically generated URL.
  • HYBRID: Combines features of both polling and webhook triggers. It can listen for events via webhooks and also poll for updates, providing flexibility in handling different event sources.
  • LISTENER: A trigger that continuously listens for specific events or messages from a source, such as a message queue or event stream, and activates when those events occur.
  • POLLING: Regularly checks a data source at specified intervals to detect changes or new data. This type is suitable for systems that do not support webhooks or real-time notifications.
  • STATIC_WEBHOOK: A trigger that listens for incoming HTTP requests at a fixed URL. This type is ideal for scenarios where the endpoint URL does not change and can be predefined.
  • WEBSOCKET: A trigger fired by a WebSocket upgrade rather than an HTTP request; the platform registers no HTTP webhook controller for it. browser/v1/voiceSession is the built-in example.

How is this guide?

Last updated on

On this page