Creating Actions

This guide walks you through creating a new Action in Fostrom using the “New Action” form. An Action runs your JavaScript in response to a trigger and can produce effects like sending messages to devices or triggering webhooks.

Prerequisites

  • You must have at least one Message Schema whose Direction is defined as Inbound or Both. Only these schemas can trigger Actions right now.

  • If you don’t see any schemas in the selector while creating an Action, first create an appropriate Message Schema.

Open the Create Action form

  1. Go to the Actions tab in the Fostrom UI.
  2. Click New Action to open the create dialog.

Fill out the form

The create dialog contains the following fields and controls.

Action Name

  • Enter a name using only lowercase letters, digits, and hyphens: a–z 0–9 -.
  • The name cannot start or end with a hyphen (-).

Tips:

  • Choose names that describe the behavior or trigger, e.g., door-open-notify, temperature-fan-control.
  • Keep it stable; renaming later can make audit trails harder to follow.

Description (optional)

Provide a short sentence explaining what the Action does. Good descriptions make it easier to maintain and discover Actions across a fleet.

Trigger Type - current and upcoming

  • Message Schema is currently supported and selected by default.
  • Coming soon:
    • Real-time calculation (5m averages) and bigger analytical pipeline based triggers (running AI models) are coming soon.
    • Device triggers (e.g., based on device connectivity like online/offline) are shown as coming soon and are not selectable yet.

This means your Action will run when an incoming message that matches the selected Message Schema arrives for now.

Selecting a Message Schema (for incoming messages only)

  • Select one Message Schema from the list. Only schemas with Direction set to Inbound or Both will appear here.

  • The selected schema defines the shape of the payload your Action will receive at runtime.

  • So the Action will have access to all the fields and their corresponding in the payload. object of the selected Message Schema. For example: payload.temprature or payload.humidity

If you don’t see the schema you expect:

  • Verify the schema is of type Message (not Datapoint).
  • Ensure its Direction is Inbound or Both.
  • Confirm it exists in the same fleet you’re working in.

Create the Action

Click Create Action. You’ll be taken to the Action editor where you can write code, test, and deploy your action.

After creation

After creating an action, you will be redirected to the action page where you can write code, test your action, and deploy it.

Troubleshooting

  • Create Action button is disabled:
    • Ensure you’ve entered a valid name that matches the allowed characters and does not start or end with -.
    • Ensure a Packet Schema is selected.
  • No Packet Schemas appear:
    • Create a Message‑type Packet Schema first and set Direction to Inbound or Both.
  • Selected the wrong schema:
    • Open the Action’s Settings after creation and change the trigger schema there.