Open the .env file and add the service credentials that you obtained in the previous step. The Watson SDK automatically locates the correct environmental variables for either username
, password
, and url
or the apikey
and url
credentials found in the .env file.
Example .env file that configures the apikey
and url
for a Watson Assistant service instance hosted in the US East region:
ASSISTANT_IAM_APIKEY=X4rbi8vwZmKpXfowaS3GAsA7vdy17Qhxxxxxxxx
ASSISTANT_URL=https://gateway-wdc.watsonplatform.net/assistant/api
- If your service instance uses
username
and password
credentials, add the ASSISTANT_USERNAME
and ASSISTANT_PASSWORD
variables to the .env file.
Example .env file that configures the username
, password
, and url
for a Watson Assistant service instance hosted in the US South region:
ASSISTANT_USERNAME=522be-7b41-ab44-dec3-xxxxxxxx
ASSISTANT_PASSWORD=A4Z5BdGENxxxx
ASSISTANT_URL=https://gateway.watsonplatform.net/assistant/api
However, if your credentials contain an IAM API key, copy the apikey
and url
to the relevant fields.
{
"apikey": "ca2905e6-7b5d-4408-9192-xxxxxxxx",
"iam_apikey_description": "Auto generated apikey during resource-key ...",
"iam_apikey_name": "auto-generated-apikey-62b71334-3ae3-4609-xxxxxxxx",
"iam_role_crn": "crn:v1:bluemix:public:iam::::serviceRole:Manager",
"iam_serviceid_crn": "crn:v1:bluemix:public:iam...",
"url": "https://gateway-syd.watsonplatform.net/assistant/api"
}
ASSISTANT_IAM_APIKEY=ca2905e6-7b5d-4408-9192-xxxxxxxx