How to create a Farcaster bot

Create a Farcaster bot on Neynar in a few quick steps


Simplest way to start is to clone this git repo that has a sample bot ready to go:

In our farcaster-examples repo, gm_bot is an automated messaging bot designed to cast a 'gm πŸͺ' message in Warpcast every day at a scheduled time. The bot operates continuously as long as the system remains online. It leverages Neynar API and is built using @neynar/nodejs-sdk.


  • Node.js: A JavaScript runtime built on Chrome's V8 JavaScript engine. Ensure you have Node.js installed on your system.


Setting Up the Environment

  1. Install PM2: PM2 is a process manager for Node.js applications. Install it globally using npm:

    npm install -g pm2
  2. Install Project Dependencies: Navigate to the project directory and run one of the following commands to install all required dependencies:

    yarn install
    npm install
  3. Configure Environment Variables:

    • Copy the example environment file:
      cp .env.example .env
    • Open the repo in your favorite editor and edit .env file to add your NEYNAR_API_KEY and FARCASTER_BOT_MNEMONIC. Optionally, you can also specify PUBLISH_CAST_TIME and TIME_ZONE for custom scheduling.

Generating a Signer

Before running the bot, you need to generate a signer and get it approved via an onchain transaction. You can easily generate a signer by using the Neynar Dev portal at

  • Login to your Neynar dev portal
  • App -> "Make a bot" -> Generate
  • Click the Sign in With Neynar button
  • Connect the bot's address, the Warpcast logged-in user must be the bot
  • If everything goes well, there will be a signer UUID, which can be used to cast as the bot!

Running the Bot

  1. Start the Bot: Launch the bot using the following command:

    yarn start
    npm run start
  2. Verify the Process: Ensure that the bot is running correctly with:

    pm2 status
  3. View Logs: To check the bot's activity logs, use:

    pm2 logs
  4. Stopping the Bot: If you need to stop the bot, use:

    pm2 kill


gm_bot is released under the MIT License. This license permits free use, modification, and distribution of the software, with the requirement that the original copyright and license notice are included in any substantial portion of the work.


  • Q1: What if gm_bot stops sending messages?
    • A1: Check the PM2 logs for any errors and ensure your system's time settings align with the specified TIME_ZONE, also ensure that the process is running.


Ready to start building?

Get your subscription at and reach out to us on Telegram with any questions!