Action context
These properties and methods are on the ctx
object which is available to every action.
ctx
also contains the following information about the currently running action:
action.slug
: The action's slugaction.url
: The absolute URL to access the actionenvironment
: The environment the action is running withinorganization.name
: The name of the action's organizationorganization.slug
: The slug of the action's organizationparams
: A key/value object containing the query string URL parameters of the running actionuser.email
: The email of the person running the actionuser.firstName
: The first name of the person running the actionuser.lastName
: The last name of the person running the actionuser.role
: The user's role in the organization. One ofadmin
,developer
, ormember
user.teams
: An array of slugs for the teams the user is a member of, if any
log
Logs anything from your action by printing a message in the Interval dashboard. Works with multiple arguments like JavaScript’s console.log. Logs are truncated at 10,000 characters.
notify
Sends a custom notification to Interval users via email or Slack. To send Slack notifications, you'll need to connect your Slack workspace to the Interval app in your organization settings.
redirect
Perform a redirect to another action, page, or external URL in the
loading.start
Kicks off a loading spinner to provide context during any long-running action work. Can also be called with a single string argument as the label, or with no arguments to display only a spinner.
loading.update
Updates any existing loading spinner initated with ctx.loading.start to dynamically provide new loading information to the action runner.
loading.completeOne
Marks a chunk of work as completed to dynamically provide granular loading progress. Can only be used after ctx.loading.start was called with itemsInQueue.