import os from flask import Flask, request, jsonify app = Flask(__name__) # API Key from Telegram BotFather. apikey = '' # Key of your chat. chatid = '' # Will recieve a post with json information at hostname:5000/update # and it will forward that to the correct user in telegram. @app.route('/update', methods=['POST']) def hello(): data = request.json print(data['message']) os.system("curl --silent -X POST https://api.telegram.org/bot" + apikey + "/sendMessage -d chat_id=" + chatid +" -d text=\""+ data['message'] +"\"") return('Good') if __name__ == '__main__': app.run()