Knock · Arazzo Workflow

Knock Bulk Set Objects and Notify

Version 1.0.0

Bulk upsert objects in a collection, wait for completion, then notify one object.

1 workflow 3 source APIs 1 provider
View Spec View on GitHub NotificationsMessagingInfrastructureWorkflowsCross-ChannelEmailSMSPushIn-AppChatSlackWebhooksMCPAI AgentsDeveloper PlatformArazzoWorkflows

Provider

knock-app

Workflows

bulk-set-objects-notify
Bulk upsert objects, poll the bulk operation, then trigger a workflow.
Submits a batch of objects for a collection, polls the returned bulk operation until completed or failed, and triggers a workflow targeting the supplied object.
3 steps inputs: apiKey, collection, data, notifyObjectId, objects, workflowKey outputs: bulkOperationId, bulkStatus, workflowRunId
1
bulkSetObjects
bulkSetObjects
Submit the batch of objects for the collection, returning a bulk operation handle to poll.
2
pollBulkOperation
getBulkOperation
Fetch the bulk operation and check its status. Re-runs this step while the operation is still queued or processing.
3
notifyObject
{$sourceDescriptions.knockWorkflowsApi.url}#/paths/~1v1~1workflows~1{key}~1trigger/post
Trigger the workflow targeting the object so its subscribers are notified now that the bulk set has completed.

Source API Descriptions

Arazzo Workflow Specification

knock-app-bulk-set-objects-notify-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Knock Bulk Set Objects and Notify
  summary: Bulk upsert objects in a collection, wait for completion, then notify one object.
  description: >-
    Bulk setting objects returns a bulk-operation handle that processes
    asynchronously. This flow submits a batch of objects for a collection, polls
    the bulk operation until it reaches a terminal status, and then triggers a
    workflow targeting one of the objects so its subscribers are notified. Every
    step spells out its request inline so the flow can be read and executed
    without opening the underlying OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: knockObjectsApi
  url: ../openapi/knock-objects-api-openapi.yml
  type: openapi
- name: knockBulkOperationsApi
  url: ../openapi/knock-bulk-operations-api-openapi.yml
  type: openapi
- name: knockWorkflowsApi
  url: ../openapi/knock-workflows-api-openapi.yml
  type: openapi
workflows:
- workflowId: bulk-set-objects-notify
  summary: Bulk upsert objects, poll the bulk operation, then trigger a workflow.
  description: >-
    Submits a batch of objects for a collection, polls the returned bulk
    operation until completed or failed, and triggers a workflow targeting the
    supplied object.
  inputs:
    type: object
    required:
    - apiKey
    - collection
    - objects
    - notifyObjectId
    - workflowKey
    properties:
      apiKey:
        type: string
        description: Knock secret API key (sk_...) used as a Bearer token.
      collection:
        type: string
        description: The collection to bulk set objects into.
      objects:
        type: array
        description: The list of object payloads to upsert in bulk.
        items:
          type: object
      notifyObjectId:
        type: string
        description: The id of the object to target with the workflow once set.
      workflowKey:
        type: string
        description: The key of the workflow to trigger.
      data:
        type: object
        description: Optional data payload passed into the workflow run.
  steps:
  - stepId: bulkSetObjects
    description: >-
      Submit the batch of objects for the collection, returning a bulk operation
      handle to poll.
    operationId: bulkSetObjects
    parameters:
    - name: Authorization
      in: header
      value: Bearer $inputs.apiKey
    - name: collection
      in: path
      value: $inputs.collection
    requestBody:
      contentType: application/json
      payload:
        objects: $inputs.objects
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      bulkOperationId: $response.body#/id
  - stepId: pollBulkOperation
    description: >-
      Fetch the bulk operation and check its status. Re-runs this step while the
      operation is still queued or processing.
    operationId: getBulkOperation
    parameters:
    - name: Authorization
      in: header
      value: Bearer $inputs.apiKey
    - name: id
      in: path
      value: $steps.bulkSetObjects.outputs.bulkOperationId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      bulkStatus: $response.body#/status
    onSuccess:
    - name: bulkDone
      type: goto
      stepId: notifyObject
      criteria:
      - context: $response.body
        condition: $.status == 'completed'
        type: jsonpath
    - name: bulkStillRunning
      type: goto
      stepId: pollBulkOperation
      criteria:
      - context: $response.body
        condition: $.status == 'queued' || $.status == 'processing'
        type: jsonpath
  - stepId: notifyObject
    description: >-
      Trigger the workflow targeting the object so its subscribers are notified
      now that the bulk set has completed.
    operationPath: '{$sourceDescriptions.knockWorkflowsApi.url}#/paths/~1v1~1workflows~1{key}~1trigger/post'
    parameters:
    - name: Authorization
      in: header
      value: Bearer $inputs.apiKey
    - name: key
      in: path
      value: $inputs.workflowKey
    requestBody:
      contentType: application/json
      payload:
        recipients:
        - id: $inputs.notifyObjectId
          collection: $inputs.collection
        data: $inputs.data
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      workflowRunId: $response.body#/workflow_run_id
  outputs:
    bulkOperationId: $steps.bulkSetObjects.outputs.bulkOperationId
    bulkStatus: $steps.pollBulkOperation.outputs.bulkStatus
    workflowRunId: $steps.notifyObject.outputs.workflowRunId