Your first task
In this tutorial you create a small JavaScript task, let a Node.js agent execute it, and confirm that it completed.
1. Create the task
- Open http://localhost:3000/addtask.html and log in if prompted.
- Under Script Source, select Manual.
- Set Task Type to Other (specify) and enter
node. - Enter a task name, for example
Hello from SheetBot. - Paste this script:
console.log("Hello from SheetBot");
- Leave Status set to Awaiting.
- Click Add Task and note the task ID.
2. Start the agent
In a terminal with your credentials exported:
export SHEETBOT_BASEURL=http://localhost:3000
export SHEETBOT_AUTH_USER=your_username
export SHEETBOT_AUTH_PASS=your_password
curl -fsSL "$SHEETBOT_BASEURL/scripts/agent.js" | node
The agent requests a task of type node, accepts it, runs the script, and reports completion. The script’s console.log output appears in the agent terminal. Because the agent polls once and exits, start it after creating the task, or run it in a loop.
3. Check the result
Open the task in the web UI. Its status should change from AWAITING to RUNNING and then COMPLETED.
Next
- Learn how tasks report data and dependency injection works in Data management.
- See how to write reusable scripts in Library script annotations.
- Browse the how-to guides for configuration and extension tasks.