General
PromptBeginner5 minmarkdown
<h1 align="center">
<a href="https://prompts.chat">
5

Sign in to like and favorite skills


Serverless Telegram bot in webhook mode to quickly interface with OpenAI's Chat Completion API
This bot supports private chats, group chats and inline mode (tagging the bot in any chat with a query) with a confirmation button so as you don't consume tokens live.
Notes:
callback_data limits, but it can be solved by saving the query in KV if requirednpm ci or yarn installnpx wrangler secret put TELEGRAM_BOT_TOKEN and set the Telegram bot tokennpx wrangler secret put OPENAI_API_KEY and set the OpenAI API keyTELEGRAM_USERNAME_WHITELIST in wrangler.tomlnpx wrangler kv:namespace create context and replace the ID of CHATGPT_TELEGRAM_BOT_KV and increase CONTEXT to more than 0 in wrangler.toml (will consume a lot more tokens), else remove kv_namespaces block entirely from wrangler.tomlCHATGPT_MODEL in wrangler.toml to whatever you want as documented at https://platform.openai.com/docs/api-reference/chat/create#chat/create-modelsystem message to set the AI's behavior, update CHATGPT_BEHAVIOR in wrangler.tomlnpx wrangler publish to deploy to Cloudflare WorkersInline Mode for the bot on BotFather to allow inline query flow{TELEGRAM_BOT_TOKEN} and {WORKERS_NAMESPACE} on the following https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/setWebhook?&allowed_updates=%5B%22message%22%2C%22inline_query%22%2C%22callback_query%22%5D&url=https%3A%2F%2Fcf-workers-chatgpt-telegram-bot.{WORKERS_NAMESPACE}.workers.dev%2F{TELEGRAM_BOT_TOKEN} and access it on your browserchatgpt - Triggers use of the bot in group chats without toggling Private Mode context - Shows stored context for the current chat clear - Clears the stored context for the current chat and any ForceReply messages