{
  "schemaVersion": 1,
  "snapshotDate": "2026-10-23",
  "slug": "reference-app-core-trigger-poll",
  "title": "Custom polling trigger",
  "section": "Library asset reference",
  "description": "Reusable code trigger evaluated at the workflow polling interval.",
  "kind": "trigger",
  "url": "/wiki/reference-app-core-trigger-poll/",
  "markdown": "/wiki/reference-app-core-trigger-poll/index.md",
  "json": "/wiki/reference-app-core-trigger-poll/index.json",
  "headings": [
    {
      "id": "sockets-and-configuration",
      "title": "Sockets and configuration",
      "depth": 2
    },
    {
      "id": "example-and-extensions",
      "title": "Example and extensions",
      "depth": 2
    },
    {
      "id": "catalog-identity",
      "title": "Catalog identity",
      "depth": 2
    },
    {
      "id": "outputs",
      "title": "Outputs",
      "depth": 2
    },
    {
      "id": "configuration-schema",
      "title": "Configuration schema",
      "depth": 2
    },
    {
      "id": "source-and-installed-versions",
      "title": "Source and installed versions",
      "depth": 2
    }
  ],
  "sources": [
    "../OpenNodeFlow-Library/work/catalog-all.mjs",
    "../OpenNodeFlow-Library/work/azure-pack-consolidation-20261022/catalog-policy.mjs",
    "../OpenNodeFlow-Library/work/developer-packs-20261022/catalog.mjs",
    "shared/seed.ts",
    "shared/storage-library.ts",
    "shared/variable-library.ts",
    "shared/control-flow.ts",
    "shared/remote-routes.ts",
    "server/runtime-library.ts",
    "shared/error-library.ts",
    "shared/storage-model.ts",
    "shared/builtin-documentation.ts"
  ],
  "family": "app-core",
  "contract": {
    "key": "app.core.trigger.poll",
    "slug": "app-core-trigger-poll",
    "name": "Custom polling trigger",
    "kind": "trigger",
    "family": "app-core",
    "packId": null,
    "category": "Triggers",
    "description": "Reusable code trigger evaluated at the workflow polling interval.",
    "inputs": [],
    "outputs": [
      {
        "id": "next",
        "name": "Next",
        "type": "control",
        "typeName": "Control",
        "required": false
      },
      {
        "id": "payload",
        "name": "Payload",
        "type": "any",
        "typeName": "Any",
        "required": false
      }
    ],
    "configSchema": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string",
          "title": "Endpoint URL",
          "default": "https://example.com/events"
        }
      },
      "required": [
        "url"
      ]
    },
    "documentation": "# Custom polling trigger\n\nFetches a JSON endpoint and emits its response for downstream processing. This is an editable polling example: despite the code comment about new work, the shipped implementation emits every successful response and performs no change detection.\n\n## Sockets and configuration\n- No input sockets.\n- **url** configuration (required string): endpoint URL; new instances default to `https://example.com/events`. Replace it before enabling.\n- **payload** (any): parsed JSON response, including objects, arrays or primitives.\n- **next** (control): automatic success route.\n\nSet the graph entry mode to poll and choose an interval of at least five seconds. The body uses fetch's default GET request, with no custom headers/body or secret lookup. It throws `HTTP <status>` on non-success status; invalid JSON or network failures also fail execution. There is no error route declared here.\n\n## Example and extensions\nA service responding `{\"items\":[{\"id\":\"example-001\"}]}` produces that object on payload every poll. For emit-on-change behavior, duplicate this asset, compare a stable cursor/event ID with `context.state`, and return `{__skip:true}` when unchanged. Decide deliberately when to checkpoint: a trigger checkpoint can survive a later downstream failure.\n\nThe engine schedules and prevents overlapping ticks per entry; this code starts no background listener. Requests execute under the hosting machine's network access. Timeouts/retries apply to the whole fetch/parse attempt and may repeat requests. The remote response becomes retained run data. Do not put credentials in URLs or assume polling provides exactly-once processing.",
    "tags": [
      "builtin",
      "trigger"
    ],
    "source": "app-builtin-catalog"
  }
}
