Watson Assistant and node-red - ibm-cloud

I am trying to use node-red to connect to my Watson chatbot using the Watson assistant v2 node. For some reason, I keep getting forbidden returns and It doesn't seem to connect properly? Has anyone managed to successfully connect to a Watson service using Node-red?
I am not sure the correct combination of API key or ID to connect to the correct service

In the Watson Assistant UI go to the Assistant you want to use, then to the Settings section. The Assistant ID and URL are shown, then in the Service credentials section the API key.
Enter them in the configuration of your node.

For those who came late for this question:
To use IBM watson node-red nodes
search for the service in IBM cloud.
Create the service.
Get the credentials.
Go to node-red editor and paste the credentials (API key + URL)

Related

Where to find IBM Cloud Function credentials to access it for Watson Assistant

I am searching for the credentials to access my cloud function from Watson assistant. Both are in Dallas region.
I have looked at various docs and blogs, all looks obsolete. I could not find the credentials that could work in Watson Assistant.
Below is one example location where i could not find credentials:
https://developer.ibm.com/recipes/tutorials/connect-watson-assistant-with-wikipedia-api-via-cloud-functions/
Could someone provide me steps or link to find or generate credentials?
More trials added
https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-actions
above link provide another link that is supposed to show me credentials but no success
Note: I can see CF-based API key for the namespace in London but not in Dallas on link -- https://cloud.ibm.com/functions/namespace-settings
Namespace
Below is a part of Watson json.
"actions": [
{
"name": "Namespace-Y1N/irs/helloworld",
"type": "cloud_function",
"parameters": {
},
"credentials": "$private.my_creds",
"result_variable": "$my_result"
}
]
Below is the cloud function
Well, the official IBM Watson Assistant docs on creating programmatic calls have that information. Look for <reference_to_credentials>. There are instructions on how to access Cloud Functions and extract the API key. Some of that is not needed if working with web actions.
The official tutorial on how to build a database-driven Slackbot with Watson Assistant also offers a way on integrating those credentials once for multiple dialog nodes. It uses a "credential node" to manage the info on how to access Cloud Function actions.
Note that Cloud Functions have the old Cloud Foundry-based namespaces and the new IAM-based namespaces. You can only see the authentication key for the Cloud Foundry namespaces. It seems that your Dallas namespace is new and IAM-enabled.
As an alternative, use the IBM Cloud CLI, log in to your org / space or namespace and then use this command to obtain the Cloud Function properties including the authentication key:
ibmcloud fn property get --auth
Create a new API key. Select Menu(Top-left), Manage, Access (AIM), IBM Cloud API Keys. Create an IBM Cloud API Key, then make sure that you save it somewhere because you will never see the key again. I hope that will help.
Your namespace "Namespade-Y1N" in Dallas is a IAM-enabled namespace. Server-based actions in dialog node of Watson Assistant does not support IAM based authentication. It can only work with CF based namespaces and CF based Cloud foundry functions. This is restriction of Watson Assistant.

IBM Watson Assistant: How to get IAM key for v1 watson assistant services

I have an IBM Watson Assistant service with username and password format and now I want to create new credentials which should have IAM key for this service, Please let us know how we can achieve this.
You can also migrate your Cloud Foundry service instance that uses un:pw to one that supports IAM. See Migrating Watson services from Cloud Foundry
There are (at least) two options to obtain IAM credentials for you IBM Watson Assistant service:
In the browser, go to the service dashboard by going to the IBM Cloud resources portal, locate your service instance, click on it and then in its dashboard on Service credentials. There you can create new credentials.
In a terminal and using the IBM Cloud CLI you can use ibmcloud resource service-key-create to generate credentials.
Both options assume that you have migrated your service instance from Cloud Foundry to IAM.
For creating a new credential, you can directly go to your watson assistant service/resource page, once there, on the left hand side, you would find "Service Credentials" menu button, there you would find an option to create a "New credential", and once the credential is created, then the "apikey" of that "New credential", would actually be your "IAM key", which can be viewed by clicking on the "View Credential" button highlighted below in the image.
*This is for IBM Watson Assistant V1 only.

Conversation connector / Watson Assistant: How to change account or workspace?

I am using the Conversation connector to implement a Slackbot with Watson Assistant. I want to move the chatbot over to another account and workspace. How can I do that without redeploying the Conversation connector and changing something in Slack?
I found that I can edit the configuration document stored in the described authdb.
In the IBM Cloud dashboard locate the Cloudant service named conversation-connector.
Click on that service and go to the Cloudant dashboard.
Click on the authdb database. There should be a single doc in it.
Edit the section conversation and adapt the username / password / workspace_id to the new values.
Save changes. Done.

How do I use a Watson Conversation service in Frankfurt using Node-RED or the node-sdk for Watson?

I'm able to use the node-red-node-watson library to call an instance of Watson Conversation hosted in the US-South region of IBM Cloud. If I try it in the Germany region, it does not work.
In github I spotted the following line
ConversationV1.URL = 'https://gateway.watsonplatform.net/conversation/api';
which is the URL for Conversation in US-South. The URL shown in Bluemix VCAP_SERVICES for the Frankfurt instance is different:
"https://gateway-fra.watsonplatform.net/conversation/api"
I'm not sure if the hard-coded URL is just a default and I just missed the code reading the actual URL from VCAP_SERVICES or if this is actually a bug.
Has somebody successfully used the Node-RED node for Watson Conversation within a region other than US-South?
When you initialize the Conversation object it should be possible to set the correct base URL. This is for Node SDK, not Node-RED:
// Create the service wrapper
var conversation = new Conversation({
username: '<username>',
password: '<password>',
url: 'https://gateway-fra.watsonplatform.net/conversation/api',
version_date: Conversation.VERSION_DATE_2017_04_21
});
I more familiar with the Python SDK and there the same (only in Python :) is working successfully for me.
For Node-RED there are two scenarios. When the Conversation service is bound to the Node-RED app, then the credentials including URL are taken from the VCAP environment. This works for me and should for you. If the service is not bound then there is a "feature gap" based on the Conversation Node source code.

Push data from dashDB to Watson Analytics using DataWorks?

I have an account in IBM Public Bluemix. I provisioned a dashDB instance and have inserted data into a dashDB table. I login to Bluemix using my IBM ID (not IBM Intranet ID)
I also have a Watson Analytics account. Please note that my Watson Analytics account/access is part of a larger team. I do not access it using the short Watson Analytics URL https://watson.analytics.ibmcloud.com. I access my account using https://watson.analytics.ibmcloud.com/home/data?loginAccountId=3ZPDZ2KL8DE0&loginTenantId=1VRPUK1QI0A5. when I go to this URL, it redirects me to IBM Intranet Authentication page and I login using IBM Intranet ID (not IBM ID).
I need to push data from the Bluemix dashDB table to the Watson Analytics account that I have.
when I create a connection in Bluemix DataWorks, it does not allow me to specify Watson Analytics URL. It allows me to enter only the user name and password. I created a connection for Watson Analytics using my IBM ID. And then created an activity to move data from dashDB to Watson Analytics. When I run the activity it fails. Please help.
you can follow steps as in the video - https://www.youtube.com/watch?v=0WAq3qVpENo
Instead of using bluemix dataWorks service, use the integrated dataworks within watson analytics by creating the data connections using dashDB credentials.
You are using an IBM internal userid that is not currently supported by DataWorks accessed via Bluemix. Short term, you will have to use the integrated DataWorks support. Unless you are developing a Bluemix application that needs to automatically push data, this will meet your needs.
Unless you are performing DataWorks cleansing operations on your data in dashDB, you can push your data into Watson Analytics directly via the API.