Skip to content

ponder-surveys/farcaster-survey-bot

Repository files navigation

📋 Ponder Surveys

An open-source NodeJS bot designed to post engaging surveys directly on Farcaster. Built on top of Farcaster Frames, Neynar, Supabase, and Thirdweb (Base mainnet) to produce automated casts, calculate results, and record both quantitative and qualitative responses.

This survey bot is a part of the Ponder ecosystem. Learn more

Table of Contents

How It Works

  1. Scheduled Surveys: Using cron jobs, this survey bot is programmed to post queued surveys at specific intervals.
  2. Supabase Backend: All survey data, including questions, responses, and reactions are stored and managed in Supabase.
  3. Automated Replies: Casts a reply automatically when the configured Farcaster account is tagged.

Prerequisites

Before you begin, ensure you have met the following requirements:

  • Node.js: Version 14.x.x or higher. Download here
  • Yarn: Version 3.3.1 or higher. Download here
  • Accounts: Ensure you have accounts on Farcaster, Neynar, and Supabase.

Quick Start

1. Clone the repository

git clone https://github.com/ponder-surveys/farcaster-survey-bot

2. Set up your environment variables

Farcaster & Neynar

FARCASTER_FID="Farcaster account id"
POLL_FID="Secondary Farcaster account id"
COMMUNITY_USER_ID="Backend user id for community surveys"
NEYNAR_API_KEY="API key with read & write permissions to Farcaster hubs"
NEYNAR_SIGNER_UUID="Farcaster signer uuid generated by Neynar"
NEYNAR_POLL_SIGNER_UUID="Secondary Farcaster signer uuid generated by Neynar"

Supabase

SUPABASE_URL="Project URL"
SUPABASE_KEY="API key with read & write access to the project"
SUPABASE_JWT_SECRET="Used to generate secure tokens"

Thirdweb

NFT_COLLECTION_ADDRESS="NFT collection used to check for holder status"
THIRDWEB_SECRET_KEY="Secret API key used to interact with Thirdweb SDK"

Survey questions

NEXT_GENERAL_QUESTION_CRON="Task scheduler (UTC) in cron syntax for general questions"
NEXT_COMMUNITY_QUESTION_CRON="Task scheduler (UTC) in cron syntax for community questions"
NEXT_EXPEDITED_QUESTION_CRON="Task scheduler (UTC) in cron syntax for expedited questions"
NEXT_QUESTION_REPLY="Customizable reply to question cast"
NEXT_QUESTION_INFO="Customizable info for question cast"

Survey results

NEXT_POLL_RESULTS_CRON="Task scheduler (UTC) in cron syntax to poll results"
NEXT_POLL_RESULTS_INTERVAL_HOURS="Interval in hours to poll results"

General

CALL_TO_ACTION="A message or action for users to take in the reply casts"
RESULTS_CALL_TO_ACTION="A message or action for users to take in the results reply casts"

3. Install dependencies

yarn install

4. Run the application

yarn start

Contributing

Your contributions are always welcome! Feel free to fork this project and submit pull requests. If you have any suggestions, ideas, or feedback, don't hesitate to reach out via direct cast on Farcaster.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Acknowledgments


Made with 💜 by @cojo.eth and @ba

Releases

No releases published

Packages

No packages published