Skip to content

Troubleshooting

Nick Marus edited this page Aug 9, 2016 · 5 revisions

Troubleshooting

Flint.hears commands not working

  • Make sure that the Flint App can receive inbound public internet connections to whatever you are using as your 'webhookUrl'. This is not the same as the 'port' setting in the config block. The 'port' setting defines what port the Node JS Express Web Server is listening on, while the 'webhookUrl' is the URL that is sent to the Spark API to reach the Node JS app. This is usually the same port, however, in cases where you are doing port address translation, you will have a different port on the webhook URL (external) than you may have on the port config. For Example if you Node JS flint App is running on port 3000 and you are translating the external port 80, you would want the 'port' config to be '3000', while your 'webhookUrl' will be 'http://myserver/flint'. If it was the opposite, you would have the 'port' as '80' and the 'webhookUrl' as 'http://myserver:3000/flint'

  • If you have changed the example webhookUrl to 'http://something/notFlint' make sure you also adjust the Express config to listen on that new URL path. For example: app.post('/notFlint', webhook(flint));

  • If you are using Cloud9 and running the examples in the 'quickstart' folder, you will either need to make sure the APP is public, or (if private) that you enable public access in the share menu for the Cloud9 application. If you don’t have this enabled, cloud9 will require authentication when the Spark API sends an inbound webhook and essentially block all inbound webhooks from the Cisco Spark API.

  • Make sure you are using the latest version of Flint 4. If you are new to Node JS, this involves either doing an “npm update” or deleting the node_modules directory and doing a “npm install” to get the latest version of the packages defined in your dependencies section of the package.json file (a ^4.0.0, indicated gets the latest version greater that 4.0.0)

  • Make sure that when you are testing you bot commands, you are not testing from the same account that Flint is authenticating as. Flint is designed to ignore commands in messages that come from itself so that loops dont occur if you happen to structure a "flint.hears()" command that outputs a message that matches another "flint.hears()" command. This is to avoid loops.

  • If you are using a “bot” account, first, interact with it from a 1:1 room, or make sure you mention it in a group room. In group rooms, bot accounts require a @mention in order to trigger the webhook. Since mentions are part of the messages that flint uses to get look for non reg-ex "flint.hears()" commands, of which are matched on first word, you will need to either switch to reg-ex based commands, or be sure to mention the bot AFTER the non reg-ex command defined in "flint.hears()". For example if you have a ‘/hello’ as the first argument in "flint.hears()", are using a bot account, and type @botname /hello, this will never match as the bot will not hear the "/hello". The mention of “@botname /hello” will not match a string based match on "flint.hears()". You would want to use a regex similar to the following to get a /hello to be recognized by a bot account:

    flint.hears(/^.*\/hello.*$/, function(bot, trigger) {
      bot.say('hello %s', trigger.personDisplayName);
    });
  • There was a documentation error in the API reference examples that has been fixed. If you were using the examples at the top of the README.md, you should be fine. The documentation had the bot and trigger variables were reversed in several of the "flint.hears()" command example.

Clone this wiki locally