How to passg customer token into IBM Watson Assistant - node.js

I want to use various fields such as customer token, customer id etc. in each session created in watson assistant v2 using nodejs.
Can I pass it directly in the createSession function or do I need to create an entitiy or intent for it to pass in Watson Assistant?

You need to pass it with the message where you want to use it. See the context parameter in that message API function. This could be the first message. The context usually stays unchanged until you overwrite the values or delete the context variable.

Related

How to handle multiple users in node js Webhook for Dialogflow ES?

New to creating Webhooks and DialogFlow chatbots. I have created a nodejs Webhook in Visual Studios to enable fulfilment in Dialogflow. However, when I have multiple users using the chatbot at the same time, the parameters in the Webhook (not parsed from Dialogflow) are shared among users. How do I alter the Webhook such that each user has their own set of parameters? I am using the Telegram integration in Dialogflow.
The parameters coming from the dialogflow are distinct for each session. If you are storing and modifying the parameters from your webhook locally, you need to use the session id as the unique key for each conversation.

Is there any method to capture the entire user input in dialogflow?

I'm building a telegram chatbot with google dialogflow. I need to save all conversations in a database (Yes, I know that Dialogflow has the history built-in, but I need to store in a database). So, I'm trying to save the history to firebase firestore with the intent function, called every time that my intent is matched (functions are defined in the inline editor, cloud functions). So, I need the user id and the full message typed by the user and the bot (not only parameters). Is there any way to do this?
I would send the conversation to logs and capture these using Audit Logs to capture them into Cloud Logging. Then I would link Cloud Logging to Firebase. You can see here how to see and write Logs into Firebase.

How do I know Slack bot's user_id?

I'm making a slack bot (A) that responses to a message from another slack bot (incoming-webhook) (B).
I'd like to know the user_id of B so that its message will be a trigger for A, where I have some problem getting it.
I tried users.list method (https://slack.com/api/users.list?token=blabla) but the B didn't appear in a result.
Do you have an idea about what method to take to know the user_id of B?
Incoming webhooks appear as apps, not as bot users on Slack. So you won't find a bot user ID in the user list as you would for normal bot users.
Apps have a bot ID, but unfortunately there is no official API method to get the list of bots / apps in a workspace. But if you have control over a workspace and can generate a legacy token you can use the unofficial API method bots.list.
There also is the official bots.info method, if you already have the bot ID and just want to know which app it belongs to.
To create a legacy token for your workspace make sure you are logged in and then go to this page.

How Does User Identification Work In Dialogflow Fulfillment Webhooks?

Let's say I have a desktop app that listens to a user, and leverages Dialogflow to determine intent.
In the app, we just call:
https://dialogflow.googleapis.com/v2/projects/my-project-name/agent/sessions/123456789:detectIntent
Let's also say the active user is "UserX" in our system, and we need to retrieve information specific to the account.
I understand that Dialogflow utilizes webhooks for fulfillment as described here:
https://dialogflow.com/docs/fulfillment/how-it-works
However, I'm unclear how user information can be sent to our webhook such that we'll be able to tell that "UserX" was the one who made the call to Dialogflow.
Can anyone explain if/how communication of user information is supported in fulfillment webhooks?
It is supported by fulfillment. There are a number of ways you can do it. Assuming that the user has communicated with the agent, the agent can then store the users response i.e. lets assume the agent asked the user what their name is. Since the agent can store that info (UserX) in a parameter, that parameter can then be passed to the fulfilment. The agent can also store user responses in context parameters and they can also be passed to the fulfilment. Finally even if the user does not provide info to the agent you can also use the dialog flow API to pass data to the agent which in turn can be passed to the fulfillment.

How to call external API in IBM Watson Conversation

I am trying to call the node service developed in actions in ibm watson conversation.
I am inputting two values say username and father name:
.
Right now there is just a link to call the external API (link for user details). I want to get the user details directly in chatbot as response once the username and fathername are entered.
I developed a node service for this. But I am not able to figure out how to connect chatbot dialog to node service.
Can anyone help?
You can either make programmatic calls from the dialog node using IBM Cloud Functions.
https://console.bluemix.net/docs/services/conversation/dialog-actions.html#dialog-actions
or you need to carry out an action, based on the detected intents.
https://console.bluemix.net/docs/services/conversation/develop-app.html#implementing-app-actions

Resources