Watson assistant api calls details - ibm-cloud

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}"
}
}

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'

Related

Unable to return locations of an account within Google's OAuth Playground

Google must have changed their logic in some way as I am unable to use previously working snippets within the Playground to return the information about a business?!
Essentially we are trying to connect through the playground, to get the Google Reviews working on our site, to do so we must go through the playground and collect the Account ID and default Location ID: https://developers.google.com/oauthplayground
We can swap the OAuth flow to client-side and add in our own OAuth Client ID. Also generate the access token when adding https://www.googleapis.com/auth/business.manage into the input your scopes [Authorize APIs], however once we have successfully connected the token we are struggling to use any of the previously working (for other projects) URLs endpoints.
Unsuccessful:
https://mybusiness.googleapis.com/v4/accounts/
Successful:
https://mybusinessaccountmanagement.googleapis.com/v1/accounts
We then when using the second link, can get the account ID associated with all the businesses: 12345654321
If we then put the request in along with the Account ID, in order to return the Primary Location ID, using:
https://mybusinessaccountmanagement.googleapis.com/v1/accounts/12345654321
https://mybusinessaccountmanagement.googleapis.com/v1/12345654321
https://mybusinessaccountmanagement.googleapis.com/v1/accounts/{parent=accounts/12345654321}
https://mybusiness.googleapis.com/v4/accounts/12345654321
We simply cannot progress any further.
Can anyone tell me the correct endpoints that are now working?

How to get Authenticated user's Google Ad Account ID using Google Ads API v0 using a REST API?

I have been trying to figure out after referring to their official documentation (Google Ads API Document) which is not clear enough
Here is what I have tried till now.
I have created an app where users can log in with their Google Ad words account. I need to fetch their Ad performance reports via REST API.
To make an API request to fetch performance reports, we need the Google Ad Words Account ID of the authenticated user. Currently, as I am testing it with my personal account, I can login to my Ad words Console and get the Ad Words Account ID. But, how do I fetch the Ad Words Account ID dynamically for other users who authenticate via my App?
I tried looking for a way in their official documentation. But I couldn't figure out.
Could someone help me with the REST API URL which needs to be called to fetch the authenticated user's Ad words Account ID.
In addition to previous answer, I guess this is what you are looking for:
https://developers.google.com/adwords/api/docs/guides/first-api-call#create_test_accounts
It explains how to setup Google Ad Words API and get your ID.
According to the documentation here Account overview, you need to list the customers to get the ID. For each user that logs in as long as they do not have access to multiple accounts you should get a single customer and their ID.
CustomerService
CustomerService provides information about your accounts. It has a
getCustomers() method that takes no arguments and returns a list of
Customer objects containing fields such as customerId, currencyCode,
and dateTimeZone. CustomerService also has a mutate() method that can
be used to update various attributes of a customer, including the
autoTaggingEnabled and conversionTrackingSetting fields.
If no clientCustomerId is specified in a request, the response will
contain multiple entries if more than one account is directly
accessible by the authenticated account.

Ionic Auth - how to retrieve data of all users?

I use the standard Ionic Auth for user authentication, which means that all user details are stored in Ionic Cloud.
How it is possible to get (retrieve) details of all users and use them in my app?
Because now I am able get just current user details, for example email address via $ionicUser.details.email
Use case 1 - I would like to list all registered users
Use case 2 - All users have custom field "group" with group name. On different page, I would like to list all users who are members of the same group as current user.
Thank you very much
To list all ionic auth users send an autenticated request to the cloud api endpoint at "/users" (see http://docs.ionic.io/api/endpoints/auth.html for other options).

API authentication from a facebook messenger bot conversation

What is the best way to authenticate with an external API from a conversation with a bot on the facebook messenger platform?
For a broad example, I would like a user of my bot to create items on their own profiles of an external website. Is there a way to get login information from the user, or connect my bot to the external website, without the user explicitly sending a message to the bot with their username and password?
What I found in the documentation under User Profile API:
You can personalize the conversation using the person's name or profile pic from the User Profile API. In order to get this information, make a GET request to https://graph.facebook.com/v2.6/?fields=first_name,last_name,profile_pic&access_token=. Read more details in the Send API reference.
This isn't quite what I'm looking for but it helps. Here's more info from the docs:
User Profile API
Request
curl -X GET "https://graph.facebook.com/v2.6/<USER_ID>?fields=first_name,last_name,profile_pic&access_token=<PAGE_ACCESS_TOKEN>"
Response
{
"first_name": "Peter",
"last_name": "Chang",
"profile_pic": "https://fbcdn-profile-a.akamaihd.net/hprofile...70ec9c19b18"
}
It depends how they come in.
If they come from your website, you can use the Send to Messengee button from within their account. Use the pass through param to link your account to the user thread.
Here's an excerpt from the documentation:
The plugin takes in a pass-through parameter defined by you. This parameter is sent back to you via a callback. You can use this to link the authentication event to a person and/or transaction. For example, a person may enter an online flow for a specific transaction and click the Send-to-Messenger button. You can pass in data to know which user and transaction was tied to the authentication event. You should encode and encrypt this parameter.
If they come directly to your bot, you would have to present them with a login of some sort (your login) from within the conversation. This would happen in a link to an mobile web URLs.

Linkedin REST API retrieve status updates of a user

I'm trying to retrieve the status updates of the authenticated user with the REST API. Is there a way to do that? I only can find a way to retrieve the status updates of the companies the user has admin rights of.
It is no longer possible with the standard LinkedIn API (If you look at their REST console, you can see all the public methods: https://apigee.com/console/linkedin?apig_cc=1).
You now need to join their partner program in order to access additional API methods now: https://developer.linkedin.com/partner-programs

Categories