This project is a Cloudflare Worker that listens to Gecko NFT sales events via Helius webhooks and sends notifications to a Telegram chat. It's based on the Helius Cloudflare Telegram template.
-
Clone this repository:
git clone https://github.com/GalacticGeckoSpaceGarage/gecko-sales-bot.git cd gecko-sales-bot
-
Install project dependencies:
bun install
-
Configure environment variables: Create a file named
.dev.vars
in the root directory and add the following variables:TELEGRAM_BOT_TOKEN=your_telegram_bot_token TELEGRAM_CHAT_ID=your_telegram_chat_id HELIUS_API_KEY=your_helius_api_key AUTH_TOKEN=your_auth_token
Replace the values with your actual credentials:
TELEGRAM_BOT_TOKEN
: Your Telegram bot token (get it from @BotFather)TELEGRAM_CHAT_ID
: Your Telegram chat ID (see instructions below)HELIUS_API_KEY
: Your Helius API key (obtain from Helius dashboard)AUTH_TOKEN
: A unique authentication token (generate as shown below)
To get your
TELEGRAM_CHAT_ID
:- Create a channel and add your bot as an administrator.
- Send a dummy message to the channel.
- Visit:
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
- Find the
"chat":{"id":
field in the response. This is yourTELEGRAM_CHAT_ID
.
To generate your
AUTH_TOKEN
, run this command in your terminal:openssl rand -base64 32
-
Deploy to Cloudflare:
bun run deploy
-
Create the webhook:
curl --request POST \ --url https://your-worker-url.workers.dev/create-webhook \ --header "Authorization: AUTH_TOKEN" \ --header "Content-Type: application/json" \ --data "{}"
Replace
your-worker-url
with your actual worker URL.
You can use this /webhook
endpoint for other Helius services that require a
webhook URL.
That's it! Your Gecko Sales Bot should now be operational and will send messages to your Telegram channel when Gecko NFT sales occur.
Modify src/index.ts
to change webhook creation or message formatting specific
to Gecko NFT sales.
- Ensure all environment variables in
.dev.vars
are correctly set for development environment. - Ensure all environment variables are manually added on the Cloudflare worker dashboard for production.
- Verify that the bot has permission to send messages to the Telegram channel.
- Review Cloudflare Worker logs for any errors.
For more assistance, refer to the Cloudflare Workers documentation or Helius documentation.