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
- Clone the
chatbot-serverproject from https://github.wdig.com/GXTech/chatbot-server.git - Download the Postman app from https://www.getpostman.com/downloads/
- When starting for the first time, you do not have to login. Click Skip signing in and take me straight to the app
- When starting for the first time, you do not have to login. Click Skip signing in and take me straight to the app
- Import the collections and environments
- Expand the File menu and click Import.
- In the modal, click on the Import Folder tab and click Choose Folders.
- Select the
chatbot-server/.postmanfolder from wherever your cloned repository is
- Open the console
- Press ctrl-alt-c, or
- Expand the View menu and select Show Postman Console
- Send a request
- Expand the
chatbot-api-v1collection - Select the
Environment - Select the
hellorequest - Click the
Sendbutton - View the decrypted response in the console
- POST https://di-gxchatbot-us-nonprod-1.appspot.com/v1/hello is the HTTP method and endpoint of the request
- Chat is the unique ID of the current chat session
- Site is the unique key of the product the chatbot is supporting
- Expires is when the chat session expires (assuming no further interaction) in the local timezone
- The JSON is the decrypted response body.
- Expand the
Adding and Updating Environments
- Click the gear icon in the upper rights
- Click on an environment name or click Add in the Manage Environments modal
- Add the following values
- HOST The URL of the API server, without servlet path, etc or trailing slash (eg: https://di-gxchatbot-us-poc-1.appspotcom).
- ORIGIN The origin to send for CORS purposes. Must be one of the origins configured to be allowed by the server.
- AES_KEY The Base64 encoded AES key to use as the client/server encryption key.
Run the following and copy the value output by the
base64command (eg:roy786dL+NMnMpjKRGDE471FsK//BDsspHFmrR2QMUI=)openssl rand -out aes.key 32 base64 aes.key
- AES_KEY_ENC The above AES key encrypted using the environments public key.
- Obtain the public key for the environment
- Copy the
publicKeyvalue in the response toGET /v1/client/configurationfor the environment - Remove
-----BEGIN PUBLIC KEY-----,---END PUBLIC KEY-----,\n, and\rfrom the string
- Copy the
- 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 Copy the output (eg:
v1.<base64 string>) into Postman.
- Obtain the public key for the environment
- The
JWT,DECRYPTED_RESPONSE_BODY, andLAST_RATABLE_MESSAGEvariables need not be defined as these are related to the session.




