Skip to content

Latest commit

 

History

History
60 lines (43 loc) · 1.24 KB

README.md

File metadata and controls

60 lines (43 loc) · 1.24 KB

telegram-notifier-cf-worker

A Cloudflare Worker that sends Telegram notifications for DAO DAO DAOs.

Development

Run locally

npm run dev
# OR
wrangler dev --local --persist

Configuration

  1. Make a new bot on Telegram with BotFather and get the token. Instructions here.

  2. Set your new bot's webhook to wherever this worker is deployed. For example:

curl -v "https://api.telegram.org/bot{BOT_TOKEN}/setWebhook?url=https://telegram-notifier.dao-dao.workers.dev/telegram&secret_token={WEBHOOK_SECRET}"
  1. Copy wrangler.toml.example to wrangler.toml.

  2. Create D1 database for production:

npx wrangler d1 create telegram-notifier
  1. Update the binding ID in wrangler.toml:
[[ d1_databases ]]
binding = "DB"
database_name = "telegram-notifier"
database_id = "<REPLACE DB_ID>"
  1. Configure secrets:
echo <VALUE> | npx wrangler secret put BOT_TOKEN
echo <VALUE> | npx wrangler secret put WEBHOOK_SECRET
echo <VALUE> | npx wrangler secret put NOTIFY_API_KEY

Deploy

npm run deploy
# OR
wrangler deploy