Skip to content
Back to skills

Using Iii

ASecurity

}) ``` </Tab> <Tab title="Rust"> ```rust use iii_sdk::{InitOptions, TriggerAction, TriggerRequest, register_worker}; use serde_json::json; let url = std::env::var("III_URL").expect("III_URL must be set"); let worker = register_worker(&url, InitOptions::default()); let result = worker .trigger(TriggerRequest { function_id: "math::add".to_string(), payload: json!({ "a": 2, "b": 3 }), action: None, // action: Some(TriggerAction::Void), // fire-and-forget // actio...

  • 18,821 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 3, 2026
developmenttypescriptpythonrustbashnodeapidocumentation

Works with

  • terminal
  • cli
  • api

Security analysis

A100/100

Pro scans all 19 files and shows the line behind each finding

Scanned September 3, 2026

npx -y skills add iii-hq/iii --skill using-iii --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Using Iii?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Using Iii
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/iii-hq-using-iii-81dc6335/badge)](https://www.skillsdirectory.com/skills/iii-hq-using-iii-81dc6335)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
<!-- generated by iii-skill-render. DO NOT EDIT (changes here are overwritten on the next render). Edit docs/0-12-0/using-iii/triggers.mdx. -->


{/* TODO: Re-link worker references to https://workers.iii.dev/workers/<name> once the Worker Docs migration ships. */}

## Call a function directly

Call a function by its `function_id` from worker code (`worker.trigger(...)`) or from the terminal
(`iii trigger`). The engine routes the call to whatever worker registered the function; no trigger
registration is involved. The `action` field controls delivery: by default the call waits for the
function to return its result, or for the configured timeout to fire. Pass a different
`TriggerAction` to change that.

<Tabs>
  <Tab title="Node / TypeScript">
    ```typescript
    import { registerWorker, TriggerAction } from "iii-sdk";

    const worker = registerWorker(process.env.III_URL);

    const result = await worker.trigger({
      function_id: "math::add",
      payload: { a: 2, b: 3 },
      // action: TriggerAction.Void(),                       // fire-and-forget
      // action: TriggerAction.Enqueue({ queue: "math" }),   // route through iii-queue
    });
    ```

  </Tab>
  <Tab title="Python">
    ```python
    import os
    from iii import register_worker, InitOptions, TriggerAction

    worker = register_worker(
        os.environ.get("III_URL"),
        InitOptions(worker_name="caller"),
    )

    result = worker.trigger({
        "function_id": "math::add",
        "payload": {"a": 2, "b": 3},
        # "action": TriggerAction.Void(),                    # fire-and-forget
        # "action": TriggerAction.Enqueue(queue="math"),     # route through iii-queue
    })
    ```

  </Tab>
  <Tab title="Rust">
    ```rust
    use iii_sdk::{InitOptions, TriggerAction, TriggerRequest, register_worker};
    use serde_json::json;

    let url = std::env::var("III_URL").expect("III_URL must be set");
    let worker = register_worker(&url, InitOptions::default());

    let result = worker
        .trigger(TriggerRequest {
            function_id: "math::add".to_string(),
            payload: json!({ "a": 2, "b": 3 }),
            action: None,
            // action: Some(TriggerAction::Void),                                  // fire-and-forget
            // action: Some(TriggerAction::Enqueue { queue: "math".to_string() }), // route through iii-queue
            timeout_ms: None,
        })
        .await?;
    ```

  </Tab>
  <Tab title="CLI">
    ```bash
    iii trigger math::add a=2 b=3
    ```
  </Tab>
</Tabs>

Some common actions are:

- **Default (synchronous)**. No `action` set. The call waits for the function to return its result
  or for the configured timeout to fire.
- **`TriggerAction.Void()`**. Fire-and-forget. The call returns immediately; the function still runs
  but the caller doesn't see the result.
- **`TriggerAction.Enqueue({ queue })`**. Provided by
  iii-queue. Routes the invocation through a named
  queue with retries; the call returns once the message is enqueued.

<Note>
  Workers can provide their own `TriggerAction`s. Check each [worker's
  documentation](https://workers.iii.dev) for the action types it offers.
</Note>

## Register a trigger

Functions can also run when a trigger is satisfied. A trigger can be any event that happens such as
a request to an `http` endpoint, a `cron` job, a change in `state`, or any other trigger that a
worker supports. You can also [write your own](../creating-workers/triggers).

You bind triggers to functions via the `function_id`. The trigger declares its `type`, its `config`
(defined by each type), and the function to invoke.

<Tabs>
  <Tab title="Node / TypeScript">
    ```typescript
    import { registerWorker } from "iii-sdk";

    const worker = registerWorker(process.env.III_URL);

    worker.registerTrigger({
      type: "http",
      function_id: "math::add",
      config: { api_path: "/math/add", http_method: "POST" },
    });
    ```
  </Tab>
  <Tab title="Python">
    ```python
    import os
    from iii import register_worker, InitOptions

    worker = register_worker(
        os.environ.get("III_URL"),
        InitOptions(worker_name="my-worker"),
    )

    worker.register_trigger({
        "type": "http",
        "function_id": "math::add",
        "config": {"api_path": "/math/add", "http_method": "POST"},
    })
    ```
  </Tab>
  <Tab title="Rust">
    ```rust
    use iii_sdk::{InitOptions, RegisterTriggerInput, register_worker};
    use serde_json::json;

    let url = std::env::var("III_URL").expect("III_URL must be set");
    let worker = register_worker(&url, InitOptions::default());

    worker.register_trigger(RegisterTriggerInput {
        trigger_type: "http".into(),
        function_id: "math::add".into(),
        config: json!({ "api_path": "/math/add", "http_method": "POST" }),
        metadata: None,
    })?;
    ```

  </Tab>
</Tabs>

Per-type configuration is documented in each worker's Worker Docs (e.g.
iii-http for the `http` type).

## Bind multiple triggers to one function

It's valid to bind multiple triggers to the same `function_id` and this can be done across any
number of types. Register a second trigger with the same `function_id` and a different type or
config; the function runs unchanged whether the call arrives over HTTP, on a cron schedule, or from
a queue message.

## Gate a trigger with a condition

A trigger can carry an optional `condition_function_id`. When the trigger fires, the engine invokes
the condition function first; the target `function_id` only runs if the condition returns truthy.
Use this when the same event source should sometimes fire the function and sometimes skip it.

## Unregister a trigger

Trigger registration returns a handle. Pass that handle to `worker.unregisterTrigger(...)` to drop
the trigger at runtime. When the worker disconnects, all of its triggers are removed automatically.

Files in this skill

  • channels.mdx5.5 KB
  • channels.mdx.skill.md5.5 KB
  • cli.mdx2.8 KB
  • cli.mdx.skill.md2.8 KB
  • console.mdx7.4 KB
  • console.mdx.skill.md7.4 KB
  • deployment.mdx3.2 KB
  • deployment.mdx.skill.md3.2 KB
  • engine.mdx2.5 KB
  • engine.mdx.skill.md2.3 KB
  • functions.mdx2.9 KB
  • functions.mdx.skill.md2.9 KB
  • triggers.mdx5.8 KB
  • triggers.mdx.skill.md5.8 KB
  • workers-registry.mdx1.6 KB
  • workers-registry.mdx.skill.md1.7 KB
  • workers.mdx6.9 KB
  • workers.mdx.skill.md6.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.