Skip to main content
A bot uses surface: "service" and its own app account to respond to events or run scheduled work. Open Manage → Bots on the Node page to see available and installed bots. The Node owner, Node moderators, and site administrators can manage bots for the Node.
Bot installations and activity in Node management

Installation and permissions

Install a bot on a Node

Under Available to install, review the app details and granted scopes. Fill in the bot’s required settings, then select Install on this node. The fields shown here are defined by the example bot.
Available bot card with permissions, settings fields, and the Install on this node button

Permissions and settings for a bot available to install

Manage an installed bot

Under Installed, update the bot’s parameters and select Save settings. You can also view its Run log or uninstall it. Uninstalling stops background execution and removes the bot’s moderator role on the Node. The installation data is retained.
Installed bot card with Save settings, Run log, and Uninstall buttons

Settings and run log for an installed bot

A site administrator can also install a bot site-wide. A site-wide bot runs as an ordinary app account. A Node bot runs as a moderator of that Node. Actions are subject to app scopes, site settings, and Node permissions.

Site events

Subscribe using the triggers array in app.json. A Node bot receives events from its Node and child Nodes. An app embedded in a post receives events from that topic. A site-wide bot can receive events from across the site. Events caused by app accounts do not trigger other apps. ctx.data contains fields applicable to the event. For example, user_id identifies the actor, and post-related events also supply topic_id and post_id. With post.read, use api.post.get(id) and api.topic.get(id) to read the content involved in the call. This example greets members whose welcome has yet to be recorded. Set surface to service, kind to bot, and placement to many. Subscribe to topic_created and request kv, post.read, and post.write.

External requests

Request the http scope and list the exact hostnames under domains. NodeLoc queues HTTPS requests for background execution. The site must enable external requests, and the hostname must be approved for the app or included in the site’s allowlist. Handle the result in onFetch. A true ctx.ok means an HTTP response arrived. Use ctx.status to decide how to handle its body.

Scheduled jobs

Declare a job with schedule.add. The job_key identifies it within the installation. Set the initial delay with in_seconds. The optional every_seconds must be at least 60 seconds. Use schedule.cancel with the same job_key to cancel it. Register jobs in onInstall and handle them in onSchedule. This example needs schedule, http, and kv. Replace api.example.com with your approved API hostname and list it under domains.
Use the CLI playtest to check the bundle and logs, then publish to the directory.