This Telegram bot shares the latest Farcaster posts containing a tracked keyword. It is built on top of the fantastic Searchcaster API.
a. Clone this repository.
git clone <repository-url>
b. Navigate to the project directory.
cd farcaster-keyword-bot
c. Install the required dependencies.
yarn install
d. Create a .env
file in the root directory of the project and add your Telegram Bot API token and Telegram Channel ID.
TELEGRAM_API_TOKEN=your-telegram-bot-api-token
TELEGRAM_CHAT_ID=your-telegram-channel-id
To get the Telegram Bot API token, create a new bot on Telegram using @BotFather. This guide breaks down the step by step process. Make sure to also add the bot to the Telegram channel in which you want to receive the updates.
To get the Telegram Channel ID, open web.telegram.org on a desktop browser and navigate to the channel. The URL will have the following format web.telegram.org/a/#TELEGRAM_CHAT_ID
.
e. Replace the keywords
array in index.js
with your own keywords.
const keywords = [
'wowow',
'stated preference',
'revealed preference',
];
f. Adjust the checkEveryMin
variable in index.js
to match your cron job schedule.
const checkEveryMin = 30;
To test the bot, use the following command:
node local-test.js
The bot will now fetch recent posts from Searchcaster based on your keywords and send these posts to your Telegram channel.
This project was set up and tested with Vercel cron jobs. It should seamlessly work with other cron services.
This project is open source and licensed under the MIT License.