Watson assistant api calls details

703 views Asked by At

We have developed a watson assistant chatbot and integrated with client application. Now we want know how many times each user calling watson service from client application and its billing details per person.

I have enabled the user metrics option using below approach and Active users graph is updated with user count. But I want to know the per user api calls details, I have checked in viewLogs(IMPROVE TAB) and Usage tab in billing section and its not showing the per user api calls and billing details. Please let me know where i can get the details of each user api calls details.

https://console.bluemix.net/docs/services/conversation/logs.html#user_id

 "context" : {
  "metadata" : {
   "user_id": "{UserID}"
   }
   }
1

There are 1 answers

3
DSeager On

There is no UI to show chats from a specific user. Instead, as described here you must use the REST API via curl to retrieve logs.

However when using user_id you cannot filter for a specific user. I have tried actually doing this but I am not able to retrieve logs for a specific user_id.

You can retrieve logs filtered for a customer_id and therefore I recommend you set both user_id and customer_id to the same value, and filter using customer_id.

To set customer_id do as the SDK docs say and add a 'headers' object to the payload sent to Assistant with X-Watson-Metadata with value customer_id. For example in NodeJS:

payload.headers = {'X-Watson-Metadata': `customer_id=CUSTOMER_ID`}
assistant.message(payload, (err, data) => {

Then you can retrieve logs for a specific customer from Assistant by filtering by customer_id:

curl -X GET -u "apikey:KEY" 'https://gateway.watsonplatform.net/assistant/api/v1/workspaces/WORKSPACE/logs?version=2018-09-20&filter=customer_id::CUSTOMER_ID'