mirror of
https://github.com/yagop/node-telegram-bot-api
synced 2025-08-30 22:05:28 +00:00
openshift example using webhook with HTTP
This commit is contained in:
12
examples/openShiftWebHook.js
Normal file
12
examples/openShiftWebHook.js
Normal file
@@ -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!");
|
||||||
|
});
|
Reference in New Issue
Block a user