360 Secure SkillHub
360 安全技能中心

crossly-workflows

该 Skill 指导使用 Crossly 的 REST API 与 SDK 读取节点目录、校验工作流图、创建或导入并激活工作流,执行测试与运行、查看节点数据和审批、轮换 Webhook,并管理销售活动;主要面向商品定价、报价、订单和通知自动化。

分类:营销
crossly
热度 9.76
最近更新 2026-11-30 12:36:57

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add crossly/crossly-workflows
兼容性
通用兼容
联网要求
需要联网
数据出网
必须出网
Metadata
name
crossly-workflows
description
Build, validate, import, activate and run Crossly workflows, the one automation engine (a graph of trigger, action, lookup and flow nodes). Read the node catalog with GET /v1/workflows/catalog, check a graph with POST /v1/workflows/validate, create from blank, a template or a crossly.workflow export document (POST /v1/workflows, /v1/workflows/import, /v1/workflows/templates/{id}/use), save with optimistic versions, activate or pause, test (mode test or dry), run on selected listings or orders, read run history and node data, decide flow.approval requests, and rotate on.webhook trigger URLs. Scopes automation:read / automation:write. Use when automating repricing, offers, sales events, shipping alerts or notifications on Crossly, or migrating off the deprecated /v1/automation/rules and /v1/workflow-chains endpoints.

Build and run Crossly workflows

A workflow is a graph of nodes. A trigger node (on.*) emits items; every other node takes items in on a port and sends items out of one or more ports; edges connect ports. A one-step automation is just a small workflow (trigger → action). Old automation rules, workflow chains and standalone sales events were converted into workflows, and the /v1/automation/rules, /v1/automation/runs and /v1/workflow-chains endpoints are deprecated facades over them (sunset 2027-03-01, see the last section).

Scopes: automation:read for every read and for POST /v1/workflows/expressions/preview; automation:write for every other write (create, save, activate, test, run, cancel, retry, decide approvals, rotate webhook URLs, end sales). Auth: crossly-api-setup. Paging, errors, idempotency: crossly-api-conventions.

import { createClient } from '@crossly/sdk';
const crossly = createClient({ pat: process.env.CROSSLY_PAT! });

Setup

  1. Create a free Crossly account: https://crossly.net/register
  2. Create a personal access token at https://crossly.net/settings/api/tokens/new (guide: https://crossly.net/guides/personal-access-tokens). Use a crossly_pat_test_ token against the sandbox while building.
  3. Export it as CROSSLY_PAT and send it as Authorization: Bearer $CROSSLY_PAT to https://crossly.net/api/v1/*. Full docs: https://crossly.net/docs

Read the catalog first

GET /v1/workflows/catalog (crossly.workflows.catalog()) returns { data: { nodes, capabilities, connectedPlatforms, expressionHelpers, expressionBindings, conditionOperators } }. Each node spec has its type, params (keys, types, defaults, min/max, required), input/output ports, outputSchema, risk and a platform capability; capabilities[key] lists the platforms that capability covers and which of them the seller has connected. Build graphs from it; never guess a node type or param key.

Node families (the catalog is the full list):

Prefix Examples
on.* triggers on.manual, on.schedule, on.webhook, on.listing.sold, on.listing.age_reached (ageDays), on.listing.no_views_after, on.order.created, on.order.ship_by_soon, on.offer.received, on.message.received, on.inventory.low_stock, on.connection.lost, on.workflow_error
flow.* flow.if (true/false), flow.filter (kept/discarded), flow.switch, flow.merge, flow.loop, flow.wait, flow.approval (approved/rejected/timeout), flow.execute_workflow, flow.ab_split, flow.limit, flow.stop
data.* data.set, data.aggregate, data.summarize, data.dedupe, data.math, data.text, data.date
actions listing.price_drop, listing.reprice, listing.publish, listing.delist, listing.auto_relist, sale.start, notify.slack / notify.discord / notify.webhook / notify.email_user, http.request, webhook.emit

Rules every node follows: money params and fields are integer cents (priceCents, floorCents, amountCents); every node puts canonical ids (listingId, orderId, inventoryItemId, platform, offerId…) on its output items, and entity id params default to them (listingId: "{{ $json.listingId }}"), so any node can follow any node.

The graph and the crossly.workflow document

{
  "version": 1,
  "nodes": [
    { "id": "age",  "type": "on.listing.age_reached", "name": "Listed 30 days", "params": { "ageDays": 30 }, "position": { "x": 0, "y": 0 } },
    { "id": "pricey", "type": "flow.if", "name": "Over $25", "position": { "x": 240, "y": 0 },
      "params": { "conditions": { "kind": "group", "combinator": "and",
        "rules": [{ "kind": "rule", "left": "{{ $json.priceCents }}", "op": "gt", "right": 2500 }] } } },
    { "id": "drop", "type": "listing.price_drop", "name": "Drop 5%", "position": { "x": 480, "y": 0 },
      "params": { "mode": "percent", "percent": 5, "floorCents": 1200 } }
  ],
  "edges": [
    { "id": "e1", "source": "age",    "sourcePort": "main", "target": "pricey", "targetPort": "main" },
    { "id": "e2", "source": "pricey", "sourcePort": "true", "target": "drop",   "targetPort": "main" }
  ],
  "settings": { "timezone": "America/New_York" }
}

Shape limits (shared zod schema): version is the literal 1; at most 300 nodes, 1,000 edges, 200 sticky notes, 2 MB serialised. Node id matches ^[a-z0-9_-]{1,40}$, name 1-120 characters. Optional per node: disabled, notes, retry (maxAttempts 1-10, backoffMs ≤ 3,600,000), timeoutMs (≤ 86,400,000), onError (inherit, stop, continue, error_output), executeOnce, pinnedData (≤ 200 items of { json }). settings: timezone (IANA), onError (stop | continue), errorWorkflowId, maxConcurrentRuns (1-50, default 5), vars, saveSuccessData (default true), notifyOnFailure (default true).

Expressions are {{ … }} holding JSONata. Bindings: $json, $trigger, $node("Name").json, $items("Name"), $run, $workflow, $now, $today, $vars, $itemIndex. Crossly helpers include $money(cents), $cents(dollars), $dollars(cents), $applyPercent(cents, -15), $roundPrice(cents, ending), $daysSince(iso), $coalesce(…). Try one without saving: POST /v1/workflows/expressions/preview { value, item?, trigger?, nodes?, runId?, timezone? } answers { ok: true, value, type } or { ok: false, error } (a bad expression is not an HTTP error). Condition operators: eq, neq, gt, gte, lt, lte, between, contains, not_contains, starts_with, ends_with, matches, in, not_in, exists, not_exists, is_empty, not_empty, is_true, is_false, before, after, within_last, older_than.

Export document. GET /v1/workflows/{id}/export returns { $schema: "https://crossly.net/schemas/workflow-v1.json", format: "crossly.workflow", exportVersion: 1, exportedAt, name, description, tags, templateId, graph, stripped } with Content-Disposition: attachment; filename="<slug>.crossly-workflow.json". Save it under that suffix: SchemaStore maps *.crossly-workflow.json to the published JSON Schema, so editors validate the file. Import ignores $schema, exportedAt and stripped, and only graph is required. Credential-looking params, headers and $vars are blanked, integration and workflow ids are set to null, pinned test data is dropped unless ?pinnedData=true; every blanked path (nodeId.paramKey, settings.vars.<key>) is listed in stripped so the importer knows what to refill.

Validate, create, import

const { data: check } = await crossly.workflows.validate(graph);       // POST /v1/workflows/validate
if (check.blocking) throw new Error(JSON.stringify(check.issues));     // issues: { level, code, message, nodeId? }

const { data: created } = await crossly.workflows.create(              // POST /v1/workflows → 201 { workflow, issues }
  { name: 'Stale listing markdown', graph, timezone: 'America/New_York' },
  { idempotencyKey: crypto.randomUUID() });

POST /v1/workflows takes from: blank (default; name, description ≤ 5,000, tags ≤ 30 of ≤ 50 chars, graph, timezone, templateId), template (templateId, setup, name, activate) or import (document, name). POST /v1/workflows/import takes the export document itself or { document, name } and answers { workflow, issues, stripped } (crossly.workflows.import(doc, { name })). A draft that does not validate can still be saved; activation refuses it.

curl -sS -X POST https://crossly.net/api/v1/workflows/import \
  -H "Authorization: Bearer $CROSSLY_PAT" -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" --data @stale-markdown.crossly-workflow.json

Templates. GET /v1/workflows/templates?category=&q= lists ready graphs (weekend sale, stale-listing markdowns, offer responder, ship-by alerts…), each with setup: [{ nodeId, paramKey, label }]. POST /v1/workflows/templates/{id}/use { setup, name?, activate? } creates it (crossly.workflows.useTemplate(id, { setup })) and returns activated. Key setup as the template lists it.

Every new workflow starts paused. Create, import, template use and duplicate count against the plan's automation limit: 402 plan_limit_reached. Saves, activation and deletes never do.

Save, activate, pause

  • PUT /v1/workflows/{id} { version, name?, description?, tags?, graph? }: pass the version you read. A save over a newer one is 409 version_conflict: re-read, merge, retry. Saving an active workflow validates it like activation.
  • POST /v1/workflows/{id}/activate: triggers start firing; blocking issues → 422 validation_error with details.issues. POST /v1/workflows/{id}/deactivate pauses (started runs finish).
  • GET /v1/workflows/{id}/versions, POST /v1/workflows/{id}/versions/{v}/restore { version? } (restores as a new version; 409 if someone saved since version), POST /v1/workflows/{id}/duplicate { name? }, DELETE /v1/workflows/{id} (archives: triggers stop, open runs cancelled, history kept).
  • List: GET /v1/workflows?active=true|false&tag=&trigger=on.listing.sold&q=&legacyRef=rule:<id>. Rows have trigger/node types and a 7-day run sparkline, not the graph; GET /v1/workflows/{id} has the graph and version.

SDK: update, activate, deactivate, listVersions, restoreVersion, duplicate, delete, list, get, export.

Test and run

// Safe test: write, destructive and money nodes report what they would do and change nothing.
const { data: test } = await crossly.workflows.test(id, { mode: 'dry' });   // POST /v1/workflows/{id}/test → 202

// Live run now on selected listings (one kind per call, up to 1,000 ids), active or paused.
await crossly.workflows.run(id, { listingIds: ['…'] }, { idempotencyKey: crypto.randomUUID() });
  • POST /v1/workflows/{id}/test { graph?, mode: test|dry, triggerNodeId?, startNodeId?, stopAfterNodeId?, triggerItems? }: test runs for real using pinned data where a node has it; dry changes nothing. Trigger items: the ones you pass, else pinned, else the last real trigger item, else the sample.
  • POST /v1/workflows/{id}/run and POST /v1/workflows/run-on ({ workflowId, … }) take items ([{ json }]), listingIds, orderIds or inventoryItemIds (≤ 1,000). The graph must validate (422 otherwise).
  • Runs are asynchronous (202). Poll GET /v1/workflow-runs/{runId} (crossly.workflows.getRun), or list with GET /v1/workflows/{id}/runs / GET /v1/workflow-runs?workflowId=&status=&mode=live|test|dry&since=&until=&page=&limit= (limit ≤ 100, default 25). Run statuses: queued, running, waiting, succeeded, failed, cancelled.
  • Item data: GET /v1/workflow-runs/{runId}/nodes/{nodeId} (getNodeRun): each port keeps the first 50 items, 16 KB per item (truncated: true). Pruned data comes back null with pruned: true; that means "no longer kept", never "no items". Successful live runs lose node data after 30 days, failed runs after 90; run rows go after 180.
  • POST /v1/workflow-runs/{runId}/cancel (409 when finished); POST /v1/workflow-runs/{runId}/retry re-runs a failed run from the failed node (new run with retryOfRunId; succeeded nodes are not repeated; 409 otherwise).

Engine limits: 5,000 node executions per run, 1,000 items into one node, 1,000 loop iterations, 50 concurrent runs per seller, maxConcurrentRuns per workflow (more queue). A failed live run notifies the seller unless settings.notifyOnFailure is false.

Approvals

A flow.approval node parks the run and notifies the seller. GET /v1/workflow-approvals?status=pending,approved,rejected,expired&workflowId= (pending by default) lists them; POST /v1/workflow-approvals/{id}/decide { decision: "approved" | "rejected", note? } (≤ 2,000 chars; approve/reject also accepted) resumes the run down that port. 409 conflict when it was already decided (another device, Telegram, or the timeout).

const { data: pending } = await crossly.workflows.listApprovals();
await crossly.workflows.decideApproval(pending[0].id, { decision: 'approved', note: 'ok' },
  { idempotencyKey: crypto.randomUUID() });

Webhook triggers

An on.webhook node gets a public inbound URL. POST /v1/workflows/{id}/webhooks/{nodeId}/rotate { withSecret?: boolean } (crossly.workflows.rotateWebhook) issues a new URL (the old one stops working) and returns { nodeId, url, secret, rotatedAt } once: store it now. A retried rotate rotates again (it is never replayed from the idempotency store).

Callers POST to that URL (https://crossly.net/api/hooks/workflows/<token>, no PAT). With a secret, send X-Crossly-Signature: sha256=<hex HMAC-SHA256 of the raw body>. Answers: 202 { runId } (never waits for the run), 401 bad or missing signature, 404 unknown/rotated token or paused workflow, 413 body over 256 KB, 429 over 60 requests a minute per token. The run's item is { body, headers (allow-listed), query, method, receivedAt }. The workflow must be active.

Sales events

A sale.start node runs a timed sale. GET /v1/workflows/sales/active (crossly.workflows.sales.active()) lists live and upcoming sales with their workflow, percent off, window and listing count; POST /v1/workflows/sales/{saleEventId}/end (sales.end(id)) ends one now: not started → cancelled, live → closed and every discounted price restored (reverted = listings put back).

Rules, chains and recipes (deprecated)

The /v1/automation/rules endpoints (including import and validate-recipe), GET /v1/automation/runs and the /v1/workflow-chains endpoints are deprecated since 2026-11-27 and work until 2027-03-01; responses carry Deprecation, Sunset and Link: rel="successor-version" headers. Each converted rule or chain is a workflow you can find with GET /v1/workflows?legacyRef=rule:<id> (or chain:<id>, sale_event:<id>). A converted workflow tagged needs-review does nothing until it validates and is activated. Recipe JSON (automation-recipe-v1) is a different, single-step format: see the crossly-automation-recipes skill; build new automations as workflows. Workflow triggers also fire on webhook events (see crossly-webhooks).

MCP (see crossly-mcp-server): get_workflow_catalog, validate_workflow, create_workflow, import_workflow, export_workflow, update_workflow, activate_workflow, deactivate_workflow, test_workflow, run_workflow, list_workflow_runs, get_workflow_run, retry_workflow_run, list_workflow_approvals, decide_workflow_approval, rotate_workflow_webhook, use_workflow_template, list_active_sales, end_workflow_sale.

Rules

  • Read GET /v1/workflows/catalog before writing a graph, and validate before you save; blocking: true means activation will be refused.
  • Dry-test (mode: "dry") before activating anything that changes prices, delists or spends money; activate only after the seller has seen the result.
  • Money is integer cents in params, items and expressions. Every repeating markdown needs a floorCents.
  • Always send version on PUT, and handle 409 version_conflict by re-reading, never by overwriting.
  • After an import, refill every path in stripped (integration ids, secrets) before activating.
  • Store a rotated webhook URL and secret at once; they are never shown again.
  • Send an Idempotency-Key on creates, runs and decisions.

Docs: https://crossly.net/docs/workflows-and-scheduled-sales · https://crossly.net/docs/automation-rules · https://crossly.net/docs/api-automation