Tooling for connectivity with the QnA Maker APIs
Last updated 6 months ago by botframework .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install qnamaker 
SYNC missed versions from official npm registry.

The new BF CLI replaces legacy standalone tools

The Bot Framework SDK team is happy to announce the General Availability of the consolidated bot framework CLI tool bf-cli. The new BF CLI tool will replace legacy standalone tools to manage Bot Framework bots and related services. The old tools will be ported over in phases and all new features, bug fixes, and further investments will focus on the new BF CLI. Old tools will still work for the time being, but they are going to be deprecated in future releases.

Upon the release of Bot Framework SDK version 4.6 the following legacy tools have been ported: Chatdown, QnAMaker, LuisGen, and LuDown.

To learn more about the BF CLI please visit the BF CLI github repository.

The following page is about a legacy tool.


npm version

QnAMaker is a command line tool and a library for interacting with QnAMaker service using the QnAMaker REST API.



As a CLI

Make sure you have Node.js >=8.5 and npm installed on your machine, then use:

npm install -g qnamaker

As a library

The QnAMaker APIs can be installed and used as a library in any Node.js or JavaScript UI projects for the browser:

npm install -s qnamaker

You can then import and use service classes specific to the endpoint and operation you wish to call.

Command line usage

Command Description
qnamaker list alterations Download all word alterations (synonyms) that have been automatically mined or added by the user.
qnamaker replace alterations --in wordAlterations.json Replace word alterations (synonyms) for the KB with the give records.
qnamaker list endpointkeys List all the currently valid endpointKeys for querying your private endpoint.
qnamaker refresh endpointkeys --keyType <string> Re-generate an endpoint key, in case you suspect your keys have been compromised.
qnamaker create kb --in createKbPayload.json Create a new knowledge base.
qnamaker delete kb --kbId <string> Delete a knowledge base by id.
qnamaker export kb --kbId <string> --environment <string> Export a knowledge base by ID.
qnamaker get kb --kbId <string> Get metadata about a knowledge base.
qnamaker publish kb --kbId <string> Publish all unpublished in the knowledge base to the prod endpoint.
qnamaker replace kb --in replaceKb.json --kbId <string> Replace knowledge base contents with new contents.
qnamaker update kb --in updateKb.json --kbId <string> Add or delete QnA pairs and / or URLs to an existing knowledge base.
qnamaker list kbs List all of your knowledge bases.
qnamaker export legacykb --kbId <legacyKB> Export legacy knowledge base (requires legacy --kbid and --subscriptionKey to be passed in).
qnamaker get operationdetails --operationId <string> Get details of a specific long running operation.
qnamaker query --question "how do I turn it on" --top 5 Return the list of answers for the given question sorted in descending order of ranking score.


A configuration object is required to provide the endpoint base path, app ID, version ID and the authoring key to each outbound call. There are 3 ways to provide this information to the CLI:

  1. As a .qnamakerrc file in the cwd. The JSON format for the .qnamakerrc file:
  "subscriptionKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "kbId": "xxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxx",
  "hostname": "https://xxxxxx.azurewebsites.net",
  "endpointKey": "xxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxx"

NOTE: Simply run qnamaker init to answer simple questions to create your .qnamakerrc file

  1. As arguments to the CLI: --kbId <string> --subscriptionKey <string>


The CLI will first look for these named configuration variables in the arguments list, then inside the .qnamakerrc file, then fallback to the environment variables.

Securing Your Access Key

To better secure your access key, it is recommended to omit the key from the .qnamakerrc file and instead pass it in to the --subscriptionKey argument or store it as the QNAMAKER_SUBSCRIPTION_KEY environment variable. If security is not a concern for your particular case, all configuration items can be stored in the .qnamakerrc for convenience.

Overriding Configurations

Since configuration items can be passed as arguments to the CLI, using arguments to specify the configuration will override the .qnamakerrc and any environment variables that may have been specified.

Nightly builds

Nightly builds are based on the latest development code which means they may or may not be stable and probably won't be documented. These builds are better suited for more experienced users and developers although everyone is welcome to give them a shot and provide feedback.

You can get the latest nightly build of QnAMaker from the BotBuilder MyGet feed. To install the nightly -

npm config set registry https://botbuilder.myget.org/F/botbuilder-tools-daily/npm/

Install using npm:

npm i -g qnamaker

To reset registry:

npm config set registry https://registry.npmjs.org/

Current Tags

  • 1.3.3                                ...           latest (6 months ago)

31 Versions

  • 1.3.3                                ...           6 months ago
  • 1.3.2                                ...           7 months ago
  • 1.3.1                                ...           a year ago
  • 1.3.0                                ...           a year ago
  • 1.2.0                                ...           a year ago
  • 1.1.0                                ...           a year ago
  • 1.0.33                                ...           2 years ago
  • 1.0.32-42                                ...           2 years ago
  • 1.0.32                                ...           2 years ago
  • 1.0.31                                ...           2 years ago
  • 1.0.30                                ...           2 years ago
  • 1.0.29                                ...           2 years ago
  • 1.0.28                                ...           2 years ago
  • 1.0.27                                ...           2 years ago
  • 1.0.26                                ...           2 years ago
  • 1.0.25                                ...           2 years ago
  • 1.0.24                                ...           2 years ago
  • 1.0.23                                ...           2 years ago
  • 1.0.22                                ...           2 years ago
  • 1.0.21                                ...           2 years ago
  • 1.0.20                                ...           2 years ago
  • 1.0.19                                ...           2 years ago
  • 1.0.18                                ...           2 years ago
  • 1.0.16                                ...           2 years ago
  • 1.0.15                                ...           2 years ago
  • 1.0.14                                ...           2 years ago
  • 1.0.12                                ...           2 years ago
  • 1.0.11                                ...           2 years ago
  • 1.0.10                                ...           2 years ago
  • 1.0.9                                ...           2 years ago
  • 1.0.7                                ...           2 years ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 1
Last Month 3
Dependencies (20)
Dev Dependencies (3)
Dependents (0)

Copyright 2014 - 2017 © taobao.org |