How to call event Analytics DialogFlow by nodejs - node.js

I'm using dialogflow v2 using npm https://github.com/googleapis/nodejs-dialogflow.
Then I have a task to call API to get the number of messages in analytics.
https://dialogflow.cloud.google.com/#/agent//analytics
use this API
https://api.dialogflow.com/api/interactions/analytics/messages?timeInterval=1.
So anyone can suggest to me how to call that API in dialogflow npm. I can not get
x-goog-access-token
x-goog-id-token

See https://developers.google.com/identity/protocols/oauth2 for more about generating the auth token for a REST request using a service account. But that isn't the problem.
The real issue is that you're trying to access an internal API, and your project likely isn't permitted to this API.
The library itself doesn't have access to that portion of the API as well, so even if you were permitted (and, I should emphasize, you're probably not), you would need to make the REST calls directly without a library.

Related

How to use Connect Services for event notifications in REST API with PHP SDK?

Helpers, I want to use Connect services with my DocuSign rest APIs integrated website. Could anyone help me out, Where can I get these in the GitHub? Basically the need is:
Once the document is fully executed, it will be routed via DocuSign connect to a folder which aligns with the name of the employee. This will require work on both the elected system as well as the DocuSign API to configure.
No problemo! These days, I suggest using an intermediate PaaS to queue and deliver the webhook notifications to your application which can live safely behind your firewall.
Here's a blog post on the technique. Note that we have PHP example software for this technique.
Once your PHP app is notified that an envelope is complete (fully signed), just download the documents from DocuSign and store them in your file system. Easy Peasy!

How to make 3rd party api call in dialogflow's inline editor

How to make 3rd party api call in dialogflow using inline editor please share if you have some code regarding this.
Thank you
You cannot make external network requests (for example an API call) from the inline editor. You need to deploy your code elsewhere. The easiest way to do this is by deploying to a paid Firebase plan. From Google:
Network calls originating from your Cloud Function for Firebase to destinations outside Google's network require billing to be enabled for the underlying Google Cloud or Firebase project.
You can create an API with the technology that you want, as long as the response from the API can be understand by Dialogflow.
You need to configure it by going to Fulfillment, and point it to your API.
The API needs to respond with this structure: Dialogflow.
And If you plan to integrate with Actions on Google, you have this repository which includes some examples of responses.
And here you have some libraries to interact with Dialogflow with different languages.

Instagram official public_content API vs unofficial JSON API

It seems that Instagram has two means of scraping public data. There is the official API for which you need to get an API key and permissions, as described in the guide https://www.instagram.com/developer/ For a tag-specific search, the official API uses the endpoint:
https://api.instagram.com/v1/tags/{tag-name}?access_token=ACCESS-TOKEN
But it also seems that many people are scraping Instagram by using a different public API (which I think is the one accessed by the front-end of the website). This "unofficial" API uses the endpoint:
https://www.instagram.com/explore/tags/{tag-name}/?__a=1
I cannot find any information regarding support for the "unofficial" version. Does anybody know what limitations may exist on this API? If this method of retrieving data satisfies the requirements of our application, is there any reason we should still engage the rigorous API token review process to get our application approved for "official" API public_content permissions?
As far as I know
Does anybody know what limitations may exist on this API?
It is a direct violation of Instagram terms of use as in here
10.We prohibit crawling, scraping, caching or otherwise accessing any content on the Service via automated means, including but not
limited
to, user profiles and photos (except as may be the result of standard
search engine protocols or technologies used by a search engine with
Instagram's express consent).
And as a developer there is no grantee that these API remain
unchanged. so you probably experiencing system fail and be forced to
re develop parts of your code times to time.
Also it worth mentioning that users won't easily give you username
and passwords of their account, as the public API just requires
confirmation to access limited account resources.
is there any reason we should still engage the rigorous API token
review process to get our application approved for "official" API
public_content permissions?
Same as a bow

Azure Event Hubs - REST API Authentication

I have a Python program that generates streaming data. Each piece of data is stored as a variable called message.
Since Event Hubs does not offer a Python SDK, I've opted to use their REST API. I've attempted to push the data to my Event Hub instance as a part of my Python program that generates data as follows:
r = requests.post("https://{Instance name}.servicebus.windows.net/{Path}/messages", message)
print(r.status_code, r.reason)
Upon executing this code, I receive a 401 Unauthorized response.
After running into this issue, I used this tutorial to try and create a shared access signature. Upon using curl to confirm that my generated token worked, I received a HTTP/1.1 401 40103: Invalid authorization token signature response.
Is there a better way to send the data while still generating it in Python? A better way to create a shared access signature?
Azure SDK for Python supports sending messages to Event Hubs: https://github.com/Azure/azure-sdk-for-python/tree/master/azure-servicebus#event-hub.
I'd suggest using the SDK but if you really want to call the REST API directly, take a look at the Event Hubs methods implementation in the SDK source: https://github.com/Azure/azure-sdk-for-python/blob/master/azure-servicebus/azure/servicebus/servicebusservice.py.

How to access a gmail account I own using Gmail API?

I want to run a node script as a cronjob which uses Gmail's API to poll a gmail account I own.
I am following these quickstart instructions:
I'm stuck on the first step. When requesting credentials for a cron script it tells me that "User data cannot be accessed from a platform without a UI because it requires user interaction for sign-in":
The docs are confusing in general, and mention "service accounts," "OAuth," and other things -- I cannot tell which apply to my use-case and which don't. I've used many SaaS APIs, and the typical workflow is to login to your account, get an API key and secret, and use those in your script to access the API. It seems this is not the paradigm used by the Gmail API, so I'd appreciate any guidance or links to clearer instructions.
I also find that the documentation can be confusing at times, but what you want to to is actually pretty straight forward once you get it:
Register your App at Google, and say what APIs you want your App to have access to (only the Gmail API in this case). This will give you two strings, a client_id and a client_secret (which is the content of the client_secrets.json-file above).
Since you are just going to write a script for your own account only, you don't need a http-server. The Oauth Playground will suffice. Press the Settings Cog on the top right and use your own OAuth credentials.
Select the Gmail API in the list of APIs and follow the outlined steps.
Now you have an access_token and a refresh_token you can use to keep your script going indefinitely!
To fully understand the use of Gmail API, going through Gmail API Overview really will make a difference.
And you can also use these documentations to start building a Gmail app:
The client libraries are available for download in several languages and simplify making API requests.
The developer guide topics help you better understand how to implement particular use cases.
The API reference gives you details on every resource and method in the Gmail API.
I hope these help.

Resources