botframework-sdk: Telegram channel issue: [400] Bad Request (BUTTON_DATA_INVALID)

Bot Info

  • SDK Platform: Node.js
  • SDK Version: 3.14.0
  • Active Channels: Telegram
  • Deployment Environment: Azure App Service (Azure Web App)

Issue Description

Telegram channel fails with following error in console:

Error: POST to 'https://telegram.botframework.com/v3/conversations/370544732/activities/K1CfSzs9lFJ' failed: [400] Bad Request
    at Request._callback (D:\home\site\wwwroot\node_modules\botbuilder\lib\bots\ChatConnector.js:559:46)
    at Request.self.callback (D:\home\site\wwwroot\node_modules\request\request.js:186:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (D:\home\site\wwwroot\node_modules\request\request.js:1163:10)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at IncomingMessage.<anonymous> (D:\home\site\wwwroot\node_modules\request\request.js:1085:12)
    at IncomingMessage.g (events.js:291:16)
    at emitNone (events.js:91:20)

In channel status log I see the following error messages:

{"ok":false,"error_code":400,"description":"Bad Request: BUTTON_DATA_INVALID"}

Code Example

var restify = require('restify');
var builder = require('botbuilder');

// Setup Restify Server
var server = restify.createServer();
server.listen(process.env.port || process.env.PORT || 3978, function () {
   console.log('%s listening to %s', server.name, server.url); 
});

// Create chat connector for communicating with the Bot Framework Service
var connector = new builder.ChatConnector({
    appId: process.env.MicrosoftAppId,
    appPassword: process.env.MicrosoftAppPassword
});

// Listen for messages from users 
server.post('/api/messages', connector.listen());

var bot = new builder.UniversalBot(connector, [
    function (session) {
        session.send("Hello!");
        builder.Prompts.choice(session, "Please select your choice, clicking the button",
                                ["Button 1", "Button 2"], { listStyle: 3 });
    },
    function(session, results) {
        if (results.response.index == 0) {
            session.beginDialog('customDialog');
        } else {
            session.endDialog();          
        }
    }
]);

bot.on('conversationUpdate', function (message) {
    if (message.membersAdded) {
        message.membersAdded.forEach(function (identity) {
            if (identity.id === message.address.bot.id) {
                bot.beginDialog(message.address, '/');
            }
        });
    }
});

Reproduction Steps

  1. Create bot application in Azure App Service
  2. Edit app.js and add the code example above
  3. Create a Telegram bot
  4. Add and register Telegram channel
  5. Try to start conversation with /start command

Expected Behavior

Expected Telegram channel to work properly.

Actual Results

When I start a conversation using /start command in Telegram, bot does not respond anything.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18

Most upvoted comments

@easkerov on my side- everything works fine.