ibm-cloud-solutions / hubot-ibmcloud-nlc

Adds a framework to enable Natural Language interactions in your Hubot scripts
http://www.ibm.com/
Other
11 stars 1 forks source link

Default script does not answer questions #104

Closed christabella closed 7 years ago

christabella commented 7 years ago

I am getting an error: Authorization was requested for a script without a valid id. Authorization is granted for unrecognized commands. You should provide an id in your scripts.

NLC.json is simply the default, e.g. nlc.data. May I know why it is not working?

The scripts already have id provided, e.g. in

    // Natural Language match
    robot.on('nlc.data', (res, parameters) => {
        robot.logger.debug(`${TAG}: nlc.data - Natural Language match.`);
        getNLCData(res);
    });

    // RegEx match
    robot.respond(NLC_DATA, {id: 'nlc.data'}, function(res) {
        robot.logger.debug(`${TAG}: nlc.data - RegEx match. `, res.match);
        getNLCData(res, res.match[2], res.match[4]);
    });

where id = nlc.data. Am I understanding it correctly?

I then suppressed the error messages by setting HUBOT_IBMCLOUD_AUTHENTICATION_DISABLED to TRUE. However, the bot still does not answer properly, e.g. answering

"Help me with nlc"

with

"Would you like help managing natural language classifiers (yes or no)?"

jlpadilla commented 7 years ago

You are getting the correct answer to

"Help me with nlc"

as that statement is defined here https://github.com/ibm-cloud-solutions/hubot-ibmcloud-nlc/blob/master/src/nlc/NLC.json#L35

If that's not what you see, what response do you get?

About the authentication problem. From the example above, the statement "Help me with nlc" should be matching the class nlc.management.help. Looking at hubot-ibmcloud-auth this class (or command id) was not added to the authorized commands. https://github.com/ibm-cloud-solutions/hubot-ibmcloud-auth/blob/master/src/scripts/ibmcloud-auth.js#L51

That's a problem that should be fixed on hubot-ibmcloud-auth. You could also disable authentication as you mentioned on the initial comment.