Each task needs to return an async function.
const { auths, libs } = require('platform');module.exports = async (event) => {console.log("Hello world");};
The function takes in an event object with topic
string and data
object. Each trigger comes with a specific topic so you can use it to differentiate between different topic sources.
// console.log(event);{"topic": "XXXXXX","data": {}}
By default, when each task is executed, the environment variables contains the following. If set, the App and Task Config Vars will also be included in the environment variable.
// console.log(process.env);{"KIWI_APP_ID": "...","KIWI_ENV": "dev","KIWI_TASK_ID": "...","KIWI_TASK_VERSION": "...","KIWI_TOPIC": "...","KIWI_REQUEST_ID": "..."}