depoio / node-telegram-bot

Client wrapper for Telegram Bot API (Under heavy development)
MIT License
136 stars 30 forks source link

Enhancement/webhook #27

Closed MrHug closed 9 years ago

MrHug commented 9 years ago

I have added an option to support the use of webhooks, rather than the polling based method. I made this some time ago, so had to rebase to the new master (like all the new features by the way :D)

If you already have a different way to support this, or you disagree with something, please let me know.

rdev commented 9 years ago

Any examples on using webhook?

MrHug commented 9 years ago

You mean example code?

logger.info("Setting up Telegram bot");
var Bot = require('node-telegram-bot');

var bot = new Bot({
  token: 'XXXXX',
  webhook: 'https://url:8443/telegram'
}).start();

Now telegram will send POST requests to the specified URL with the messages.

rdev commented 9 years ago

Thanks. It would be nice to put this in examples folder just in case ;)

MrHug commented 9 years ago

Sure thing :)

MrHug commented 9 years ago

Added example in c287a4fd4c5eae504e663c7d3101b836fde120c3