Fliplet Help

How to use Actions

Create an action with the AI chat in Fliplet Studio, check it, make it live, change or stop it, and run it from screen code.

An action is a piece of code that runs in the background when something triggers it, with nobody pressing a button. Use an action to send reminders on a schedule or to react when a new record is added.

This guide shows how to create an action with the AI chat in Fliplet Studio, check it, make it live, change or stop it, and run it from screen code.

Before you start

You need:

  • Editor access to the project, to create, change or delete an action.
  • Publisher access, to publish an action.
  • Credits on your plan, because runs on the server can use them. [UNVERIFIED: which projects are metered isn't established]

Decide what should start the action. This is its trigger.

TriggerWhen the action runsWhat you provide
ManualOn demand, for example when screen code runs itNothing extra
ScheduleAt set timesA frequency and a timezone
LogWhen an entry in a data source is created, updated or deletedThe data source and the change
AnalyticsWhen an analytics event happens, for example a page is viewedWhen it should run, in plain words

A screen event, such as going to a thank-you screen after a form is submitted, belongs in the screen and not in an action.

Create an action

Actions are built in the AI chat. You can start from the Action Builder page, as these steps do, or describe the outcome in the chat without opening it.

  1. Select Actions in the project sidebar. The Action Builder page opens.
  2. Select Create action. Studio closes the page and sends Suggest some actions I could add to my project to the AI chat.
  3. Tell the AI chat what you want to happen and when.
  4. Answer the AI chat's questions.
  5. Read the summary of what the action does, when it runs and what data it touches.
  6. Confirm the summary.

The action isn't created until you confirm, and a skipped question doesn't count as confirming. If you change anything after confirming, the AI chat summarizes the action and asks again. New actions are created Enabled unless you ask for them to start Disabled.

The AI chat works on one action at a time, so a second request in the same chat can change the first action.

What the AI chat needs from you:

  • Data: it looks in the project first, asks for what it can't find, and checks that a data source you name exists.
  • Schedule: have the frequency and timezone ready. The frequency * * * * *, which is every minute, is rejected. If a repeat within an hour doesn't divide 60 evenly, the AI chat explains and proposes the closest valid intervals.
  • Credentials for a third-party service: the AI chat collects these through a secure configuration panel, so don't paste them into the chat. An action that reads a credential has to run on the server, so an analytics action can't read one.

The AI chat chooses whether the action runs on the server or in the browser, and doesn't ask.

Check the action

  1. Select Actions in the project sidebar.
  2. Find the action in the table, which shows Action, Trigger, Created, Modified and Status.
  3. Select the action's row to open its details. [UNVERIFIED: row details not seen in Studio, the project has no actions] The first row opens by itself when the table loads.
  4. Select View Logs to see the action's runs. [UNVERIFIED: label read from the page source, not seen in Studio]

View Logs opens on the last 7 days. Once the action is published, it shows the published copy's runs. Each server run logs a completed or failed entry with its duration, payload and any error.

The Action Builder page has no control that runs an action. [UNVERIFIED: read from the page source, not seen in Studio] To try an Enabled action, run it from screen code or wait for its trigger.

Make the action live

Studio keeps a working copy of each action, and publishing makes a separate published copy.

> [!WARNING] > A scheduled action that's saved Enabled is queued straight away. It can run before the project is published.

  1. Select Publish in the top bar.
  2. Publish the project. See Publishing for the steps.
  3. Ask the AI chat whether the action is published.

Publishing the project copies every action to the published project. [UNVERIFIED: the link from the Publish button to this code is inferred, and only a first publish is covered]

An action can't be published on its own until the project has been published. Trying gives this error:

The app must be published before publishing actions. Please publish the app first.

Change an action

  1. Select Edit Action in the action's details. [UNVERIFIED: label read from the page source, not seen in Studio] Studio sends a message to the AI chat asking to edit that action, with the action selected.
  2. Tell the AI chat what to change.
  3. Confirm the summary.

A change to a published action goes live when the action is published again. When you change a published action through the AI chat, the chat publishes it again, and the action keeps its run logs.

Stop an action

  1. Turn off the Status toggle in the action's row. [UNVERIFIED: toggle read from the page source, not seen in Studio] The toggle changes the Studio copy straight away.
  2. Select Edit Action, if the action is published.
  3. Ask the AI chat to publish the action.

The published copy keeps its old state until the action is published again. Publishing a Disabled action takes the published copy off its schedule.

Don't unpublish an action to stop it. Publishing it again creates a new copy that loses the link to its earlier run logs.

Go back to an earlier version

  1. Select Version history in the action's details. [UNVERIFIED: this label and Restore read from the page source, not seen in Studio]
  2. Find the version you want. You can preview any row.
  3. Select Restore on that row.
  4. Select Restore version to confirm.

The version you replace stays in the history. Restoring changes the Studio copy only, including whether the action is Enabled. For a published action, select Edit Action, then ask the AI chat to publish it.

Delete an action

> [!CAUTION] > This cannot be undone. Deleting an action also deletes its published copy.

The AI chat can't delete actions.

  1. Select Delete in the action's details. [UNVERIFIED: label read from the page source, not seen in Studio]
  2. Type the action's exact name.
  3. Select Delete in the dialog.

Run an action from screen code

Action code defines an execute function, and the payload you pass arrives as context.payload. Code from the AI chat returns { success: true } or { success: false, error: "message" }.

async function execute(context) {
  console.log(context.payload);

  return { success: true };
}

Your screen code runs the action by name. Use run() to run it, or runWithResult() to wait for its result.

// Run the action
Fliplet.App.V3.Actions.run('send-reminders', { region: 'EU' });

// Run the action and wait for its result
Fliplet.App.V3.Actions.runWithResult('send-reminders', { region: 'EU' }).then(function(result) {
  console.log(result);
});

Use the name, because a numeric ID only works in the copy of the project it belongs to.

How the action runs depends on where the AI chat set it to run:

  • Server: the call goes through the Fliplet API, which allows 30 requests per 60 seconds per user.
  • Client: an Enabled action runs in the browser with an empty context.settings. If it takes longer than 30 seconds, it raises V3 Action did not complete within 30 seconds. A Disabled action does nothing and only logs to the console.

If the action doesn't work

What you seeWhat it meansWhat to do
The action isn't in the tableIt wasn't created, or the table is filteredCheck you confirmed the summary, clear the search and set Show: to All
Cannot run an inactive action. Please activate the action first.The action is DisabledTurn Status on, and if it's published, select Edit Action and ask the AI chat to publish it
Client-side actions cannot be executed on the server. This action must run in the browser.The action is set to run on the clientRun it from screen code with the JavaScript SDK
App Task not foundNo action in the project has that name or IDCheck the name you passed
Action not foundThe action is in another copy of the project and not in this one [UNVERIFIED: fix made after the last check]Run it by name, and check it's published
Code validation failed: followed by reasonsThe action's code didn't pass checks when savingTell the AI chat the message
A scheduled run didn't happenYour organization may be out of creditsThe schedule resumes when credits return

See also

  • Build workflows with App Actions: the overview of actions.
  • Create and configure an App Action: every setting in detail.
  • Test and debug an App Action: how to find out why a run failed.
  • Publishing: how to publish a project.
  • App Actions reference: the full JavaScript API.

Open this page in the app: /build/app-actions/use-actions