Installation
MessageKit is a powerful framework that simplifies the process of building messaging bots on xmtp. Here’s a step-by-step guide to get you started.
CLI
This tool simplifies the creation and configuration of new apps.
bun
bun create message-kit
Refer to structure of the app so see the folder is created.
Example
Start with a simple app that replies with gm
.
src/index.ts
run(async (context: HandlerContext) => {
// Get the message and the address from the sender
const { content, sender } = context.message;
// To reply, just call `reply` on the HandlerContext.
await context.send(`gm`);
});
You can also pick one of the 2 full examples available.
Variables
Create a .env
file in the root of your project
cmd
KEY= # 0x... the private key of the bot wallet (with the 0x prefix)
Run the bot
Follow the steps below to run the bot
yarn
# Install the dependencies
yarn install
# Run the app
yarn dev
Test
Send a message to the app, and it will reply gm
!
Examples
one-to-one
: A simple, customizable, and powerful conversational frameworkgroup
: Group chat app example.
Manual Installation
You can also install the package manually using your preferred package manager.
bun
bun i @xmtp/message-kit