Webhooks
A user can define webhooks which will send POST requests to the specified URL when certain conditions are met.
Defining Webhooks
Webhooks are defined at the workflow level.
All hooks take a HookParameters
field which includes the URL and header that should be used in the POST request.
- pydantic model linq.hooks.HookParameters
Show JSON schema
{ "title": "HookParameters", "type": "object", "properties": { "url": { "title": "Url", "type": "string" }, "headers": { "additionalProperties": { "type": "string" }, "description": "HTTP headers to include in the request", "title": "Headers", "type": "object" } }, "required": [ "url" ] }
- Fields:
- field url: str [Required]
- field headers: dict[str, str] [Optional]
HTTP headers to include in the request
- to_api_input() HookParametersInput
- classmethod from_api_output(api_output_parameters: HookParameters) Self
Currently, users may define the following hooks:
RunStateChangeHook
TaskStateChangeHook
SafetyStateChangeHook
LabwareMovementHook
NewPlanHook
RunStateChangeHook
will send a POST request when the run changes state.
- class linq.hooks.RunStateChangeHook(*, parameters: HookParameters, filter: Literal[Filters.ON_RUN_STATE_CHANGE] = FieldInfo(annotation=NoneType, required=True, description='Event type triggering the hook. No longer required.', deprecated=True))
Hook to be triggered when a run state changes.
TaskStateChangeHook
requires a task ID. A POST request will be sent when the specified task enters a new state.
- class linq.hooks.TaskStateChangeHook(*, parameters: HookParameters, filter: Literal[Filters.ON_TASK_STATE_CHANGE] = FieldInfo(annotation=NoneType, required=True, description='Event type triggering the hook. No longer required.', deprecated=True), task_ids: list[str] = FieldInfo(annotation=NoneType, required=True, description='List of task IDs that the hook should be triggered for. If empty, the hook will be triggered for all tasks.'))
Hook to be triggered when a task state changes.
SafetyStateChangeHook
will send a POST request when the safety state changes.
- class linq.hooks.SafetyStateChangeHook(*, parameters: HookParameters, filter: Literal[Filters.ON_SAFETY_STATE_CHANGE] = FieldInfo(annotation=NoneType, required=True, description='Event type triggering the hook. No longer required.', deprecated=True))
Hook to be triggered on changes to the state of the safety adapter.
LabwareMovementHook
requires labware IDs (for specific labware items, otherwise leave blank for all labware) and a trigger field to be set (start, end or both). A POST request will be sent when the selected trigger event occurs.
- class linq.hooks.LabwareMovementHook(*, parameters: HookParameters, filter: Literal[Filters.ON_LABWARE_MOVEMENT] = FieldInfo(annotation=NoneType, required=True, description='Event type triggering the hook. No longer required.', deprecated=True), labware_ids: list[str] = FieldInfo(annotation=NoneType, required=True, description='List of labware IDs that the hook should be triggered for. If empty, the hook will be triggered for all labware.'), trigger_on: Literal['start', 'end', 'both'] = FieldInfo(annotation=NoneType, required=False, default='both', title='Trigger On', description="When to trigger the hook. 'start' triggers the hook when the labware is picked up, 'end' triggers the hook when the labware is placed down, 'both' does both."))
Hook to be triggered when labware is transported.
NewPlanHook
will send a POST request when a new plan is created.
- class linq.hooks.NewPlanHook(*, parameters: HookParameters, filter: Literal[Filters.ON_NEW_PLAN] = FieldInfo(annotation=NoneType, required=True, description='Event type triggering the hook. No longer required.', deprecated=True))
Hook to be triggered when a new plan is generated.
Webhook Requests
Hook Post requests have the following formats: