This example script sends a welcome message when it's added to a new group, only once.
Tip
See XMTP's cursor rules for vibe coding agents and best practices.
- Node.js v20 or higher
- Yarn v4 or higher
- Docker (optional, for local network)
To run your XMTP agent, you must create a .env file with the following variables:
WALLET_KEY= # the private key of the wallet
ENCRYPTION_KEY= # encryption key for the local database
XMTP_ENV=dev # local, dev, productionYou can generate random xmtp keys with the following command:
yarn gen:keysWarning
Running the gen:keys command will append keys to your existing .env file.
# git clone repo
git clone https://github.com/ephemeraHQ/xmtp-agent-examples.git
# go to the folder
cd xmtp-agent-examples
cd examples/xmtp-group-welcome
# install packages
yarn
# generate random xmtp keys (optional)
yarn gen:keys
# run the example
yarn dev