Intermediate5 min

Exporting Workflows

Export your workflows in various formats for backup, sharing, or integration into your codebase.

Export Formats

JSON

The complete workflow definition in JSON format.

Use cases:

  • Backup and restore
  • Version control (Git)
  • Import to another account
  • Programmatic manipulation

JavaScript/TypeScript

Your workflow as executable code.

Use cases:

  • Run outside the platform
  • Integrate into existing codebase
  • Customize with native code
  • Self-host the automation

Template

A shareable version others can import.

Use cases:

  • Share with the community
  • Distribute to team members
  • Sell on the marketplace

Exporting to JSON

From the Editor

  1. Open your workflow
  2. Click ... menu > Export
  3. Select JSON
  4. Download the file

Via API

curl -X GET https://api.specway.com/v1/workflows/{id}/export \
  -H "Authorization: Bearer {token}" \
  -H "Accept: application/json"

JSON Structure

{
  "version": "1.0",
  "workflow": {
    "id": "wf_abc123",
    "name": "My Workflow",
    "nodes": [...],
    "connections": [...],
    "settings": {...}
  },
  "exportedAt": "2024-01-15T10:30:00Z"
}

Exporting to Code

From the Editor

  1. Open your workflow
  2. Click ... menu > Export
  3. Select JavaScript or TypeScript
  4. Choose runtime options
  5. Download the code

Code Options

Runtime:

  • Node.js
  • Deno
  • Browser (ESM)

Dependencies:

  • Bundled (single file)
  • External (package.json included)

Generated Code Example

import { createWorkflow } from '@specway/sdk';

const workflow = createWorkflow({
  name: 'My Workflow',
  trigger: {
    type: 'webhook',
    config: { method: 'POST' }
  },
  steps: [
    {
      type: 'http',
      config: {
        url: 'https://api.example.com/data',
        method: 'GET'
      }
    },
    {
      type: 'condition',
      config: {
        field: 'response.status',
        operator: 'equals',
        value: 'active'
      }
    }
  ]
});

export default workflow;

Running Exported Code

# Install dependencies
npm install @specway/sdk

# Run the workflow
node workflow.js

Creating Templates

Prepare for Sharing

Before exporting as a template:

  1. Remove sensitive data - No API keys or tokens
  2. Use placeholders - Mark fields users need to fill
  3. Add documentation - Describe what the workflow does
  4. Test thoroughly - Ensure it works from scratch

Export as Template

  1. Open your workflow
  2. Click Share > Create Template
  3. Add title and description
  4. Select category
  5. Choose visibility (public or team)
  6. Click Create

Template Metadata

{
  "template": {
    "name": "Slack Notifications",
    "description": "Send Slack messages on form submission",
    "category": "notifications",
    "tags": ["slack", "forms", "notifications"],
    "requiredIntegrations": ["slack"],
    "configurationSteps": [
      "Connect your Slack workspace",
      "Select the notification channel"
    ]
  }
}

Importing

Import JSON

  1. Go to Workflows
  2. Click Import
  3. Select your JSON file
  4. Review the imported workflow
  5. Click Create

Import from URL

  1. Go to Workflows
  2. Click Import > From URL
  3. Paste the JSON URL
  4. Review and create

Duplicate Detection

When importing, the system checks for:

  • Duplicate workflow IDs
  • Conflicting names
  • Missing integrations

You can choose to:

  • Create new (separate workflow)
  • Overwrite (replace existing)
  • Skip (cancel import)

Best Practices

Version Control

Keep workflows in Git:

  1. Export to JSON regularly
  2. Commit to repository
  3. Track changes over time
  4. Collaborate via PRs

Backup Strategy

Regular exports protect your work:

  1. Schedule weekly JSON exports
  2. Store in secure location
  3. Test restore process periodically

Documentation

When sharing templates:

  1. Explain the use case
  2. List prerequisites
  3. Describe configuration steps
  4. Include example data

Next Steps

Tags

workflowsexportcode