Simple command line client for Juji platform
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Initial commit Jan 3, 2019
package.json remove large sample data file Jan 26, 2019

Juji Client

npm version

juji is a simple command line client for Juji platform. Juji platform enables organizations to easily create chatbots to engage their audience and to understand their audience through data analytics.

npm install juji-client

The source code of this project is intended to show the usage of Juji API. The code is written in Javascript on Node.js. Please consult Juji API reference for description of the Juji API.

In this client, the following commands can be used:

$ juji help
Usage: juji [options] [command]

Simple Juji client

  -V, --version   output the version number
  -h, --help      output usage information

  chat <url>      chat with a Juji bot
  login           login to Juji
  logout          logout from Juji
  analyze <file>  upload data to Juji for analysis
  query <query>   issue GraphQL query to Juji
  help [cmd]      display help for [cmd]


This client can be used to chat with the Web release of a Juji bot.

$ juji chat
URL is required
Usage: juji-chat [options] <url>

Chat with a Juji bot. Does not require login.

  -f, --firstName <firstName>  first name (default: "Guest")
  -l, --lastName [lastName]    last name
  -e, --email [email]          email address
  -h, --help                   output usage information

  juji chat -f Mary

Currently, only text based chat is supported. GUI forms are not handled yet. A sample chat session:

$ juji chat -f John
=== Welcome to Juji Bot ===
Hey, John, it’s nice to connect again! I cannot wait to find out what you learned at school today.
What was your favorite subject studied today?
> i don't have a favorite
No favorite? It doesn't have to be your absolute favorite, just name one you enjoyed or would enjoy.
> ok, computer science
Sure thing. computer is my fav subject too.
Could you tell me why?

Authentication is not required to chat with Juji bots.

Login and logout

The rest of the functionality of this client requires authentication.

Use email and password to login and obtain a token from Juji, and the encrypted token is saved on disk. Subsequent queries need this token in the request header.

Logout clears the token.

$ juji help login
Usage: juji-login [options]

Login to Juji

  -e, --email <email>        email address used for Juji account
  -p, --password <password>  password for Juji account
  -j, --juji [host]          Juji host (default: "")
  -h, --help                 output usage information

  juji login -e -p secret

Upload data to analyze

Juji can perform individual trait analysis based on the text an individual wrote. The traits currently include big5 personality and many others.

After login, CSV or JSON document containing id and text can be uploaded to Juji to obtain trait analysis results.

$ juji help analyze
Usage: juji-analyze [options] <file>

Upload a file to Juji for analysis

  -h, --help  output usage information

  The input file name should have either .json or .csv suffix. They should have similar structure: csv file should have two columns, the first being an id column, and the second a text column, and there should be no header; json file should be a vector of objects, where each object has two fields, an "id " and a "text"

  The output will be a csv file with a header, and column names are the name of traits. The output is printed directly to console.

  juji analyze mytext.csv
  juji analyze mytext.json > result.csv

GraphQL query and mutation

After login, juji query command can be used to send query and mutation to Juji GraphQL endpoint. Consult Juji GraphiQL for documentation on the available queries.

Query string is passed in as is, and the variables need to be the fields of a JSON object string. The results, a JSON document, is printed to console.

$ juji help query
Usage: juji-query [options] <query>

Issue GraphQL query to Juji

  -v, --variables [variables]  supplies GraphQL variables in JSON format
  -h, --help                   output usage information

  juji query '{getBrands {name}}'
  juji query -v '{"brandName": "mycorp"}' 'query engagements($brandName: String!) {getEngagementsByBrand(brandName: $brandName) {name order status}}'

For example, the first example query above returns something like this:

  "getBrands": [
      "name": "mycorp"

Then the second example query above returns something like this:

  "getEngagementsByBrand": [
      "name": "Test Analytics",
      "order": 1,
      "status": "active"
      "name": "AI App 2",
      "order": 2,
      "status": "active"