From f881e8bb9474b6052d3483d9ed4a77b210d1ef16 Mon Sep 17 00:00:00 2001 From: yago Date: Tue, 30 Jun 2015 01:09:28 +0200 Subject: [PATCH] openshift example using webhook with HTTP --- examples/openShiftWebHook.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 examples/openShiftWebHook.js diff --git a/examples/openShiftWebHook.js b/examples/openShiftWebHook.js new file mode 100644 index 0000000..c459449 --- /dev/null +++ b/examples/openShiftWebHook.js @@ -0,0 +1,12 @@ +var TelegramBot = require('node-telegram-bot-api'); + +var token = 'YOUR_TELEGRAM_BOT_TOKEN'; +var port = process.env.OPENSHIFT_NODEJS_PORT; +var host = process.env.OPENSHIFT_NODEJS_IP; + +var bot = new TelegramBot(token, {webHook: {port: port, host: host}}); +bot.setWebHook('myapp-yagop.rhcloud.com:443/bot'+token); +bot.on('message', function (msg) { + var chatId = msg.chat.id; + bot.sendMessage(chatId, "I'm alive!"); +});