npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

botica-lib-node

v0.6.0

Published

Node library for botica

Readme

Botica Node.js Library

This library provides the official Node.js (and TypeScript) support for developing bots that run inside a Botica environment.

Installation

Using the official template

If you are starting from scratch, we recommend using one of the official templates to set up your project:

These templates contain:

  • A Node.js project configured for Botica bots
  • Scripts for building and packaging your bot:
    • build.sh (Linux/macOS)
    • build.bat (Windows)
  • A Dockerfile preconfigured for Botica environments
  • Example bots implemented with the library
  • A package.json file exposing the imageTag property, used by the build scripts

Using npm

Add the library dependency to your package.json:

{
  "dependencies": {
    "botica-lib-node": "~0.6.0"
  }
}

As botica-lib-node is built with TypeScript, it includes type definitions for seamless integration into TypeScript projects.

Creating your first bot

To implement a bot, you will interact with the Bot instance obtained from the botica() function and define its behavior using its provided methods.

Example: reactive bot

This bot registers an order listener for process_data actions programmatically within its main function.

import botica from "botica-lib-node";

async function main() {
  const bot = await botica();

  bot.on("process_data", async (payload) => {
    console.log("Processing data: " + payload);
    const processedResult = process(payload);
    await bot.publishOrder("results_key", "store_processed_results", processedResult);
  });

  await bot.start();
}

function process(data) {
  return data.toUpperCase(); // Example processing
}

main().catch(console.error);

Example: proactive bot

This bot defines a proactive task using the proactive() method, which will run periodically as configured in the environment file.

import botica from "botica-lib-node";

async function main() {
  const bot = await botica();

  bot.proactive(async () => {
    await bot.publishOrder("raw_data", "process_data", "sample");
  });

  await bot.start();
}

main().catch(console.error);

Entry point

Each bot requires an entry point that starts the Botica runtime. The botica() function establishes the connection with the Botica Director and initializes your bot.

import botica from "botica-lib-node";

async function main() {
  const bot = await botica();
  // Configure your bot here
  await bot.start();
}

main().catch(console.error);

[!NOTE] Botica bots are designed to run exclusively within a Botica environment, not as standalone applications. You cannot simply run your bot's entry point manually.

Check out Running your bot in the documentation to learn how to run your bot in a Botica environment.

Further documentation

For a complete overview of botica-lib-node features and detailed guides, please refer to the full documentation:

To understand how bots interact inside a Botica environment, including core platform concepts, refer to the main Botica documentation:

Example projects

Explore these real-world and demonstrative projects built with botica-lib-node to see the concepts in action.

  • Botica Fishbowl infrastructure: A simulation of a 9x9 fishbowl where multiple fish bots move around and a manager bot tracks their positions. This project showcases proactive (fish) and reactive (manager) bots written in both Node.js and Java, demonstrating inter-language communication and file system interaction.

    • Node.js Fish Bot: A proactive bot that periodically publishes its position within the fishbowl.
  • Automatic REST API testing system with RESTest: A real-world application automating REST API testing. Generator bots create test cases, executor bots run them, and reporter bots analyze results, demonstrating distributed processing and complex workflow orchestration using various Node.js bots.

    • RESTest Proxy Bot: A specialized bot that acts as an intermediary for all requests coming from executor bots. It opens a server that proxies incoming requests, forwarding them to the actual destination.
  • Botica Telegram Frontend Bot: A Telegram bot frontend that allows other bots to send information, ask for input, or request confirmation from human users via Telegram, demonstrating external service integration.

License

This project is distributed under the MIT License.