Documentation

Do you use documentation to use NewBot Framework

Emulator

You have two ways to test your chatbot:

  1. Via the terminal
  2. In the browser
  3. Via the BotFramework Emulator software
  4. Test directly on an external platform

Terminal

The interest of testing via the terminal is to install nothing on your machine and simulate the source (messenger, vibrate, etc.)

Type newbot emulator on your project. If you use formats, the JSON format will be returned to you

To test the formats from another source, for example Messenger, type newbot emulator -s messenger

No need to have accounts on different sources, it's just a simulation

Graphic emulator

The interest of testing via the emulator is

  1. Enjoy an enhanced graphical user interface
  2. To have Hot Reloading (by modifying a file in the skill, it restarts the server without affecting ngrok and the current emulator)

First, Type newbot serve in the terminal

This performs a listen on port 3000. To change the port: newbot serve -p <PORT>

In the browser

Go to http://localhost:3000 (or another port if it has been changed)

BotFramework Emulator

Type newbot serve in the terminal

  1. Download version 4 on your machine: [BotFramework Emulator] (https://github.com/Microsoft/BotFramework-Emulator/releases)
  2. Click File > Open Bot
  3. Select the file emulator.bot located at the root of your project

Test directly on Messenger

  1. Verify that you have the correct configuration in the newbot.config.js file
module.exports = {
    platforms: {
        messenger: {
            accessToken: '__FILL_YOUR_TOKEN_HERE__',
            appSecret: '__FILL_YOUR_SECRET_HERE__',
            verifyToken: '__FILL_YOUR_VERIFYTOKEN_HERE__',
        }
    }
}
  1. Type newbot serve in the terminal.
  2. This gives you a URL generated by the ngrok program. Add this URL in the Messenger webhook

Test on Amazon Alexa

  1. Add the following template in Amazon Alexa:
{
    "interactionModel": {
        "languageModel": {
            "invocationName": "<INVOCATION NAME>",
            "intents": [
                {
                    "name": "NewBotIntent",
                    "slots": [
                        {
                            "name": "any",
                            "type": "any"
                        }
                    ],
                    "samples": [
                        "{any}"
                    ]
                },
                {
                    "name": "AMAZON.NavigateHomeIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.CancelIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.HelpIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.StopIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.PauseIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.ResumeIntent",
                    "samples": []
                }
            ],
            "types": [
                {
                    "name": "any",
                    "values": [
                        {
                            "name": {
                                "value": "a test"
                            }
                        },
                        {
                            "name": {
                                "value": "a simple sentence"
                            }
                        },
                        {
                            "name": {
                                "value": "what is your name?"
                            }
                        }
                    ]
                }
            ]
        }
    }
}
  1. Add an endpoint:

Default Region: <ADRESSE NGROK>/emulator/alexa Option: My development endpoint is a sub-domain of a domain that has a wildcard certificate from a certificate authority

© 2019 NewBot