Storyblok · Arazzo Workflow

Storyblok Asset to Story

Version 1.0.0

Sign an asset upload, create a story that references the asset, then publish it.

1 workflow 1 source API 1 provider
View Spec View on GitHub CMSContent DeliveryContent ManagementHeadless CMSImage OptimizationREST APIVisual EditorWebhooksArazzoWorkflows

Provider

storyblok

Workflows

asset-to-story
Reserve an asset, reference its CDN URL in a new story, and publish it.
Signs an asset upload to obtain its final CDN filename, embeds that filename into a new story's content, and publishes the story.
3 steps inputs: assetFolderId, componentType, contentType, filename, space_id, storyName, storySlug outputs: assetId, assetUrl, publishedAt, storyId
1
signUpload
signAssetUpload
Request a signed asset upload, which creates the asset record and reserves its final CDN URL.
2
createStory
createStory
Create a story whose content references the reserved asset CDN URL as an image field.
3
publishStory
publishStory
Publish the story so the asset-bearing content goes live.

Source API Descriptions

Arazzo Workflow Specification

storyblok-asset-to-story-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Storyblok Asset to Story
  summary: Sign an asset upload, create a story that references the asset, then publish it.
  description: >-
    Brings an uploaded asset into published content. The flow first requests a
    signed upload from the asset CDN, which also creates the asset record and
    reserves its final CDN URL, then creates a story whose content references
    that CDN filename, and finally publishes the story. Note that the actual
    binary upload to the returned post_url is performed out of band against the
    asset CDN and is not part of this API description. 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: managementApi
  url: ../openapi/storyblok-management-api-openapi.yml
  type: openapi
workflows:
- workflowId: asset-to-story
  summary: Reserve an asset, reference its CDN URL in a new story, and publish it.
  description: >-
    Signs an asset upload to obtain its final CDN filename, embeds that
    filename into a new story's content, and publishes the story.
  inputs:
    type: object
    required:
    - space_id
    - filename
    - componentType
    - storyName
    - storySlug
    properties:
      space_id:
        type: integer
        description: Numeric ID of the Storyblok space.
      filename:
        type: string
        description: The filename of the asset to be uploaded (e.g. "hero.jpg").
      contentType:
        type: string
        description: MIME type of the file, such as image/jpeg.
      assetFolderId:
        type: integer
        description: Optional asset folder ID to place the asset in.
      componentType:
        type: string
        description: Component type name to set on the story content.
      storyName:
        type: string
        description: Display name of the story to create.
      storySlug:
        type: string
        description: URL-safe slug segment for the story.
  steps:
  - stepId: signUpload
    description: >-
      Request a signed asset upload, which creates the asset record and
      reserves its final CDN URL.
    operationId: signAssetUpload
    parameters:
    - name: space_id
      in: path
      value: $inputs.space_id
    requestBody:
      contentType: application/json
      payload:
        filename: $inputs.filename
        content_type: $inputs.contentType
        asset_folder_id: $inputs.assetFolderId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      assetId: $response.body#/id
      assetUrl: $response.body#/filename
      postUrl: $response.body#/post_url
  - stepId: createStory
    description: >-
      Create a story whose content references the reserved asset CDN URL as an
      image field.
    operationId: createStory
    parameters:
    - name: space_id
      in: path
      value: $inputs.space_id
    requestBody:
      contentType: application/json
      payload:
        story:
          name: $inputs.storyName
          slug: $inputs.storySlug
          content:
            component: $inputs.componentType
            image: $steps.signUpload.outputs.assetUrl
    successCriteria:
    - condition: $statusCode == 201
    outputs:
      storyId: $response.body#/story/id
  - stepId: publishStory
    description: Publish the story so the asset-bearing content goes live.
    operationId: publishStory
    parameters:
    - name: space_id
      in: path
      value: $inputs.space_id
    - name: story_id
      in: path
      value: $steps.createStory.outputs.storyId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      publishedAt: $response.body#/story/published_at
  outputs:
    assetId: $steps.signUpload.outputs.assetId
    assetUrl: $steps.signUpload.outputs.assetUrl
    storyId: $steps.createStory.outputs.storyId
    publishedAt: $steps.publishStory.outputs.publishedAt