Connect your FileBrain project with Telegram to provide instant access to your documents through chat.
Use our built-in Telegram bot functionality for instant deployment. No coding required.
RecommendedBuild your own bot using our API for complete customization control.
AdvancedNavigate to your project settings and find the "Telegram Integration" section.
Click "Enable Telegram Bot" and follow the setup wizard. You'll receive a unique bot token.
Click the provided Telegram link or search for your bot's username in Telegram to start chatting.
For developers who want to create their own Telegram bot implementation, here's a Python example using our API:
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
import requests
# Initialize bot with your tokens
def init_bot(telegram_token, filebrain_api_key, project_id):
updater = Updater(token=telegram_token, use_context=True)
dispatcher = updater.dispatcher
# Handle /start command
def start(update, context):
update.message.reply_text('Hi! Send me a message to search your documents.')
# Handle messages
def handle_message(update, context):
query = update.message.text
# Call FileBrain API
response = requests.post(
'https://filebrain.pro/api/chat/v1/',
headers={'Authorization': f'Bearer {filebrain_api_key}'},
json={
'message': query,
'project_id': project_id
}
)
if response.status_code == 200:
answer = response.json()['answer']
update.message.reply_text(answer)
else:
update.message.reply_text('Sorry, I encountered an error.')
# Register handlers
dispatcher.add_handler(CommandHandler("start", start))
dispatcher.add_handler(MessageHandler(Filters.text, handle_message))
return updater
# Start the bot
if __name__ == '__main__':
updater = init_bot(
'YOUR_TELEGRAM_TOKEN',
'YOUR_FILEBRAIN_API_KEY',
'YOUR_PROJECT_ID'
)
updater.start_polling()
updater.idle()
Having trouble setting up your Telegram bot? Our support team is here to help: