Warning
You're browsing the documentation for an old version of Webiny. Consider upgrading your project to Webiny 5.40.x.
Use with caution!
This feature is experimental and is subject to change in future releases.
Can I use this?

This feature is available since Webiny v5.39.0.

What you’ll learn
  • difference between public and private Background Tasks
  • how to define your own Background Task
  • how to register your Background Task

Overview
anchor

First, you need to know that there are two types of Background Tasks:

  • public - can be called via GraphQL API or the programmatic API
  • private - can be called only through the programmatic API

Definition of the task is the same for both types of tasks, with a difference of the method name used to define the task.

Basic Definition
anchor

To see all available properties, and information about the properties, for the task definition, check the ITaskDefinitionexternal link interface.

There are few properties, which should not be used:

  • fields - not implemented yet
  • isPrivate - set automatically when a user defines a task via createPrivateTaskDefinition

Public Task
anchor

Private Task
anchor

Advanced Definition
anchor

Registering the Task
anchor

Of course, as all other Webiny plugins, users must register the task definition in the plugins array of the createHandler function.