
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@xmtp/bot-kit-pro
Advanced tools
A database-backed bot framework for running high reliability XMTP bots
To get started building Bots with XMTP head first BotKit.
Bot Kit Pro is an advanced framework designed for complex workflows that require high reliability.
Every bot and conversation has a JSON state object you can write to from inside your bot handler. Keep track of values between messages to build complex conversation workflows.
Bot Kit Pro connects to the XMTP network via GRPC for reliable, high-performance message streaming. Every message is stored in a database to ensure that messages are processed only once. If your bot is offline for some time, it will fill in missing messages to ensure every message gets processed. You can also run multiple instances of your bot in parallel to allow for zero-downtime deploys.
A common complaint from developers using XMTP to build bots is the high cost of running client.conversations.list()
after restarting their apps. We added a database-backed cache so that apps need to decrypt a conversation only once.
No more poring over server logs. Because every incoming and outgoing message is stored in a database, you can build admin pages using tools like Retool to view the history of your bot's replies.
Bot state management is handled by the framework. The state of each bot and conversation is stored in the database, allowing for reliable recovery in case of failures. The state can be accessed and modified in the bot handler function.
Here is a minimal example of using bot-kit-pro in your application:
yarn install @xmtp/bot-kit-pro
import { newBotConfig, run } from "@xmtp/bot-kit-pro"
async function start() {
const config = newBotConfig(
"test",
{
xmtpEnv: "production",
},
async (ctx) => {
ctx.reply("hi")
},
)
await run([config])
}
start()
yarn
package manager version 2.x or 3.x or 4.xOnce you have these requirements, you can use this mono repo for testing and development
# go into the package
cd packages/bot-kit-pro
# install dependencies
yarn install
# running the bot
./dev/up
Each bot expects a configration, which can be created using newBotConfig
.
You can also optionally provide application-level configuration to specify howt he database connection is established. The following environment variables are respected for app level configuration, and take precedence over any configuration values provided in code.
POSTGRES_CONNECTION_STRING
If no application config is specified, default values are provided that correspond with the DB in the docker-compose.yml
file.
The state of the bots and conversations can be viewed directly in the Postgres database. The bots, conversations, and messages tables contain the relevant information.
yarn
./dev/up
yarn test
FAQs
A database-backed bot framework for running high reliability XMTP bots
The npm package @xmtp/bot-kit-pro receives a total of 0 weekly downloads. As such, @xmtp/bot-kit-pro popularity was classified as not popular.
We found that @xmtp/bot-kit-pro demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.