Go back

Scheduled Actions & More

February 6, 2023

Changelog

With this release we are further bridging the gap between Deta Cloud and Deta Space by adding support for Scheduled Actions, formerly known as Cron, to Space.

Viewing Scheduled Actions

Introducing Scheduled Actions

Scheduled actions allow you to run specific tasks on a schedule, for example to send a daily newsletter, to update a database every hour, or to run any other task you built into your app.

Scheduled actions are defined in the Spacefile on the Micro level and support both Cron Expressions and Rates:

micros:
- name: backend
src: backend
engine: nodejs16
run: "node index.js"
actions:
- id: "cleanup"
name: "Clean Up"
description: "Cleans up unused data"
trigger: "schedule"
default_interval: "0/15 * * * *"

Each action has a unique ID, a name, and a description, as well as a trigger type. The trigger needs to be set to schedule and the default_interval can be set to either a cron expression or a rate. The default_interval is the interval that will be used when the action is created for the first time. A user of the app can change the interval of the action at any point in the future (more below).

When the action gets run, a POST request will be sent to a specific path of your Micro with the action ID in the event body. You can then use the action ID to identify the action that was triggered and run the corresponding code. More information on how to handle scheduled actions can be found in the Micro Basics.

When you or a user installs your app, the scheduled actions will be automatically created and run on the schedule you defined in the Spacefile. As a user, you can view the status of your scheduled actions in the “Scheduled Actions” tab in your app’s settings and can change the interval through an easy to use UI at any point.

Changing a Scheduled Action

To get started with scheduled actions, update the Space CLI to the latest version (space version upgrade) and checkout the scheduled actions Developer Basics and User Manual.

We’ve got a lot more planned for actions in the coming months (triggers beyond schedules). In the meantime, we are excited to see what you build with scheduled actions and are looking forward to your feedback!

Builder Instance

Another change we have made to prepare ourselves for the upcoming merge of Deta Cloud into Deta Space is turning the “Development Instance” into the “Builder Instance”. With this rebrand we want to make it clear that this instance is not just for development, but for building and using your app as well. It is your own live instance of your Builder project that you can use for whatever you want, from developing, to testing, to using.

With this change we’ve also given the “Develop” tab of a Builder project a new look and structure:

New Develop Tab

The Micros section now includes more details about each Micro and allows you to quickly filter your runtime logs by a specific Micro. Below you’ll find all the scheduled actions you have defined in your Spacefile. The data section moved to its own “Data” tab and now shows an embedded Base/Drive UI without the need to open a modal. As before, you’ll find your API keys and environment variables in the “Configuration” tab.

We hope you like these changes and as always thank you for all the great feedback we have received!