From 17109283cbe08fbbfc2f7a6edf56588a7701a5c9 Mon Sep 17 00:00:00 2001 From: Yaroslav Smirnov Date: Sun, 27 Mar 2016 17:40:03 +0300 Subject: [PATCH] add reference to body-parser This example did not work for me until I added body-parser. Without it, the `message` in `app.post` was always `undefined`. --- examples/ex1.webhook.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/examples/ex1.webhook.js b/examples/ex1.webhook.js index 2a08d0f..6195fde 100644 --- a/examples/ex1.webhook.js +++ b/examples/ex1.webhook.js @@ -2,6 +2,7 @@ const TeaBot = require('../main')('YOUR_TELEGRAM_BOT_TOKEN', 'YOUR_TELEGRAM_BOT_NAME'); const express = require('express'); +const bodyParser = require('body-parser'); const app = express(); TeaBot.onError(function (e) { @@ -16,6 +17,11 @@ TeaBot dialog.sendMessage('Send me /help for more information.'); }); +app.use(bodyParser.urlencoded({ + extended: true +})); +app.use(bodyParser.json()); + TeaBot.setWebhook('YOUR_URL_HERE'); app.post('/', function (req, res) {