Sends Telegram message when webhook with header X-Auth: [WEB_AUTH]
is received.
Uses X-Service-Name
, X-Event
and X-Tags
for more info.
X-Service-Name
: Friendly name of service. E.g.: 'Server'X-Event
: What ever string you like your event to be. E.g.: 'Up', 'Down'X-Tags
: Custom tags
The message has the following format:
The check [X-Service-Name] has gone [X-Event]!
Tags: [X-Tags]
Intended to be used with healthchecks webhooks. Configure like this:
When running locally you'll need to install wrangler npm i -g @cloudflare/wrangler
And then log in with your cloudflare account: wrangler login
Run wrangler secret put [name]
for each.
WEB_AUTH
: Free form token to authorize webhook. Is use a long (>128) base64 key.
TELEGRAM_BOT_KEY
: Key from Telegram BothFather. E.g.: 49548951621:a6087sofdzulaisjd_ASDaz789sdgup
TELEGRAM_CHAT_ID
: id of your personal chat with the bot.
You can get the key by creating a chat with your bot (Follow BotFather instruction for how-to).
And then query https://api.telegram.org/bot[key]/getUpdates
Probably need to set CF_ACCOUNT_ID
env variable when using more than one account.
Instructions
setx CF_ACCOUNT_ID <account_id>
You may need to restart you IDE for changes to take effect
export CF_ACCOUNT_ID=<account_id>
You may need to restart you IDE for changes to take effect
Then run wrangler dev
Local
wrangler publish
GitHub Actions
Set secrets:
CF_ACCOUNT_ID
: Your cloudflare account id
CF_API_TOKEN
: Cloudflare api token with at leastworker access rights
wrangler tail