1

I'm trying to create a bot using new Microsoft's Bot Framework and Node.JS.

The problem is that, even thought I give the verifyBotFramework() method the right AppId and App Secret, I keep getting forbidden.

The bot works just fine in the emulator, but when I try to reach it through Telegram, it says "Forbidden".

Also, I can't use the "Test connection to your bot", since it doesn't even return an error message.

Here goes my code:

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

var server = restify.createServer();

//Criando bot e adicionando diálogos
var bot = new builder.BotConnectorBot();
bot.add('/', new builder.CommandDialog()
    .matches('^set name', builder.DialogAction.beginDialog('/profile'))
    .matches('^quit', builder.DialogAction.endDialog())
    .onDefault(function(session) {
        if (!session.userData.name) {
            session.beginDialog('/profile');
        } else {
            session.send('Hello, %s!', session.userData.name);
        }
    })
);


bot.add('/profile', [
    function(session) {
        if (session.userData.name) {
            builder.Prompts.text(session, 'What would you like me to call you instead?');
        } else {
            builder.Prompts.text(session, 'Hey there =). What\'s your name?');
        }
    },
    function(session, results) {
        session.userData.name = results.response;
        session.endDialog();
    }
]);

//Configurando Restify
server.use(bot.verifyBotFramework({ appId: 'myappid', appSecret: 'myappsecret' }));
server.post('/v1/messages', bot.listen());
server.listen(process.env.port || 3978, function() {
    console.log('%s listening to %s', server.name, server.url);
});

And no, I'm not using "myappsecret" and "myappid", I just replaced them here.

PS: I'm using the App Secret generated by the framework control panel. I tried both the primary and secondary App Secrets.

4

1 に答える 1