Spaces:
Sleeping
Telegram β Resume PDF relay (Cloudflare Worker)
HF Spaces block outbound traffic to api.telegram.org, so the HF app can receive
Telegram webhooks but can't send replies. This tiny Cloudflare Worker runs on a
network that can reach Telegram: it receives the webhook, calls your HF
/api/generate (which works publicly), and sends the PDF back to Telegram.
Cloudflare Workers are free, always-on, and ctx.waitUntil() lets the Worker ack
Telegram instantly then finish the ~30β60s job in the background (so Telegram
doesn't time out and retry).
One-time setup (~15 min)
Create the Worker
- Go to https://dash.cloudflare.com β Workers & Pages β Create β Create Worker.
- Give it a name (e.g.
jaa-telegram-relay) β Deploy (creates a placeholder). - Click Edit code, delete the sample, paste the contents of
relay/cloudflare-worker.js, then Deploy. - Copy the Worker URL, e.g.
https://jaa-telegram-relay.<you>.workers.dev.
Set the Worker's Variables & Secrets Worker β Settings β Variables and Secrets β add (type "Secret" for the token):
Name Value TELEGRAM_BOT_TOKENyour BotFather token ALLOWED_USER_IDSyour numeric Telegram ID (comma-separated for more) HF_API_URLhttps://saitejatirunagari-jaa-ats-tool.hf.spaceHF_API_TOKENyour API_SECRET_TOKEN(same value as the HF secret)WEBHOOK_SECRETany random string (optional but recommended) Re-deploy after saving. Point Telegram at the Worker (paste in a browser, filling in token/secret/worker URL):
https://api.telegram.org/bot<TOKEN>/setWebhook?url=https://jaa-telegram-relay.<you>.workers.dev&secret_token=<WEBHOOK_SECRET>Expect
{"ok":true,...,"description":"Webhook was set"}. (This replaces the old HF webhook β the bot now flows through Cloudflare.)Make sure
API_SECRET_TOKENis set on the HF Space (it gates/api/generate) and equals the Worker'sHF_API_TOKEN.
Use
Message the bot a job link or paste the job description β it replies with the tailored PDF. The HF Space must be public (the Worker calls it unauthenticated with the API token).
Notes
- First request after the HF Space has been idle is slower (cold start ~30s).
- LinkedIn/Indeed links may not be fetchable server-side; the bot will ask you to paste the description text (always works).
- The Worker holds no resume data β HF uses your bundled default resume.