BotKit by Fedify
BotKit is a framework for creating ActivityPub bots. It is powered by Fedify, a lower-level library for creating ActivityPub server applications. Unlike Mastodon bots, BotKit is designed to create a standalone ActivityPub bot, which is a complete ActivityPub server in itself and not limited to Mastodon's capabilities (such as the 500-character limit per post).
BotKit's API is so simple and easy to use that you can create a complete bot in a single TypeScript file. Here's an example of a simple bot that just greets:
import{createBot,mention,text}from"@fedify/botkit";import{RedisKvStore}from"@fedify/redis";import{Redis}from"ioredis";// Create a bot instance:constbot=createBot<void>({// The bot will have fediverse handle "@greetbot@mydomain":username: "greetbot",// Set the display name:name: "Greet Bot",// Set the profile icon (avatar):icon: newURL("https://mydomain/icon.png"),// Set the bio:summary: text`Hi, there! I'm a simple fediverse bot created by ${mention("@hongminhee@hollo.social")}.`,// Use Redis as a key-value store:kv: newRedisKvStore(newRedis()),// Use Redis as a message queue:queue: newRedisMessageQueue(()=>newRedis()),});// A bot can respond to a mention:bot.onMention=async(session,message)=>{awaitmessage.reply(text`Hi, ${message.actor}!`);};// Or, a bot also can actively publish a post:constsession=bot.getSession("https://mydomain/");setInterval(async()=>{awaitsession.publish(text`Hi, folks! It's an hourly greeting.`);},1000*60*60);exportdefaultbot;For more information, see the BotKit docs.