To assist in testing, a collection of Postman requests have been created. It supports multiple features, including automatic decryption of responses and outputting useful session details.

Using Postman

  1. Clone the chatbot-server project from https://github.wdig.com/GXTech/chatbot-server.git
  2. Download the Postman app from https://www.getpostman.com/downloads/
    1. When starting for the first time, you do not have to login. Click Skip signing in and take me straight to the app
  3. Import the collections and environments
    1. Expand the File menu and click Import.
    2. In the modal, click on the Import Folder tab and click Choose Folders.
    3. Select the chatbot-server/.postman folder from wherever your cloned repository is
  4. Open the console
    1. Press ctrl-alt-c, or
    2. Expand the View menu and select Show Postman Console
  5. Send a request
    1. Expand the chatbot-api-v1 collection
    2. Select the Environment
    3. Select the hello request
    4. Click the Send button
    5. View the decrypted response in the console
      1. POST https://di-gxchatbot-us-nonprod-1.appspot.com/v1/hello is the HTTP method and endpoint of the request
      2. Chat is the unique ID of the current chat session
      3. Site is the unique key of the product the chatbot is supporting
      4. Expires is when the chat session expires (assuming no further interaction) in the local timezone
      5. The JSON is the decrypted response body.

Adding and Updating Environments

  1. Click the gear icon in the upper rights
  2. Click on an environment name or click Add in the Manage Environments modal
  3. Add the following values
    1. HOST The URL of the API server, without servlet path, etc or trailing slash (eg: https://di-gxchatbot-us-poc-1.appspotcom).
    2. ORIGIN The origin to send for CORS purposes. Must be one of the origins configured to be allowed by the server.
    3. AES_KEY The Base64 encoded AES key to use as the client/server encryption key.
      1. Run the following and copy the value output by the base64 command (eg: roy786dL+NMnMpjKRGDE471FsK//BDsspHFmrR2QMUI=)

        openssl rand -out aes.key 32
        base64 aes.key 
    4. AES_KEY_ENC The above AES key encrypted using the environments public key.
      1. Obtain the public key for the environment
        1. Copy the publicKey value in the response to GET /v1/client/configuration for the environment
        2. Remove -----BEGIN PUBLIC KEY-----, ---END PUBLIC KEY-----, \n, and \r from the string
      2. Use the chatbot-utils package to encrypt the AES Key

        Note that the configuration file can be any valid config file (even for a different environment) as long as it has crypto.public.v1.* configured. The public key is overridden in this example.

        java -cp target/chatbot-utils-0.1-SNAPSHOT-jar-with-dependencies.jar com.disney.gxtech.chatbot.utils.Crypto /
            --mode encrypt --config /etc/disney/gxchatbot/appengine.properties --module public /
            --override crypto.public.v1.publicKey=<publicKey> --input aes.key
      3. Copy the output (eg: v1.<base64 string>) into Postman.

    5. The JWT, DECRYPTED_RESPONSE_BODY, and LAST_RATABLE_MESSAGE variables need not be defined as these are related to the session.