WAS Slack Bot Integration - VCAP_SERVICES environment variable set up

114 Views Asked by At

"https://watson-personal-assistant.github.io/developer/further-topics/slackbot-integration/"

Based on the instructions from the above link, I am able to make the python app work locally. However, I am not able to set up the VCAP_SERVICES environment value for it running in bluemix. My Questions:

  1. A VCAP_SERVICES value JSON example
  2. How to set it up in Bluemix App? I do not see an option to add/update the VCAP_SERVICES in the console. Is it due to my Trial account authority limitations?
2

There are 2 best solutions below

0
On

Your link in the description is broken. Here is the URL to the documentation on Slack client integration for Watson Assistant Solutions https://watson-personal-assistant.github.io/developer/slack/about_slackbot/

Step 2 in the tutorial explains how to use a .env to set the environment variables. Here is the link to the documentation.

https://watson-personal-assistant.github.io/developer/slack/creating_a_slackbot/

If you don't want to put user environment variables in a .env file IBM Cloud also allows you to define those as user defined variables. You can also use the command line option suggested by Henrik.

See the IBM Cloud documentation https://console.bluemix.net/docs/services/watson/getting-started-variables.html#vcapServices

1
On

The documentation link seems to be broken. Because you already seem to work on the command line, I would recommend the following approach. Use bx cf set-env to set environment variables:

bx cf set-env YOUR_APP_NAME_HERE SLACK_API_TOKEN VALUE
bx cf set-env YOUR_APP_NAME_HERE BOT_ID VALUE
...
bx cf set-env YOUR_APP_NAME_HERE FALLBACK_RESPONSES "I didn't quite catch that, I don't understand"

The above commands would add the variables and their value to the runtime environment. Then use the restage command as stated. Another option is to add the variables in the browser UI. After navigating to the app details, there is a tab for environment settings.