Getting Google Calendar Events with React Native (Expo) using API KEY - react-native

I am trying to list my own calendar events on my app using my Google API API_KEY but it isn't working. Is this possible without authenticating a user since I only want to display my calendar?
Something Like:
var response = await fetch(`${googleApiConfig.calendarBaseUrl}/calendar/calendars/${calendarId}?
key=${googleApiConfig.key}`)
var json = await response.json()
Where calendarId (the calendar I am fetching) belongs to me. I don't want to grab other peoples calendar...

I figured out that the resource I was attempting to fetch was requiring OAuth 2.0. In order to fetch an event list of a specific calendar you need to use the following api endpoint:
https://www.googleapis.com/calendar/v3/calendars/${CALENDAR_ID}/events?key=${API_KEY}
Accessing /events on a calendar doesn't require authentication using OAuth 2.0

Related

Generating Google Pay Token without UI

We have a use-case where we need to authorize a payment using a native payment on the web but use two different merchants. We want the user to press pay with Google and go through the ui but access google pay api with two different merchants. paymentsClient.loadPaymentData(paymentDataRequest).then(function(paymentData){ // if using gateway tokenization, pass this token without modification paymentToken = paymentData.paymentMethodData.tokenizationData.token; }).catch(function(err){ // show error in developer console for debugging console.error(err); });
is it possible to get the callback from this api request without a user interaction for the second request.

How to save data in a salesforce account using react-native?

We are building an Application and we need to store some data to the user's Salesforce account. I looked into some solutions where people are using Apex but I am unable to understand how to use them with React Native.
Please give me some good documentations to refer of How can I save my data from my React Native App to my Salesforce Account.
I tried to look into Apex and visualforce but not understanding how to use it with React Native.
For react Native you will have to call REST API exposed by salesforce. You will need to create a connected app and get the security key and client id. Use them to authenticate and get a access_token. Once you have that token, use it to make a POST call to /services/data/v45.0/sobjects/Account using the account id. Send a JSON payload to add your data.
Example of a GET call is :
/services/data/v45.0/sobjects/Account/0013600000udFs8AAE
Hope this helps!

Getting the user's "Last Seen" from a Telegram bot?

When I chat with a telegram user, I can see for each user their "last seen" - when they last connected to Telegram (even if I haven't chatted with them for a while).
Is there a way to query for this information via the bot API? I haven't found a way to access it.
It's not possible with the Telegram Bot API.
But it's possible with Telegram API which allows you to build your own customized Telegram clients, and have other methods like read messages, or status (limited by the target users' privacy settings, of course).
After generate an hash to authenticate your API client on my telegram, you can use a library like Telegram-MTProto to call contacts.getStatuses which return an array of ContactStatus and know if user is online or offline.
const getStatuses = async () => {
const statuses = await telegram('contacts.getStatuses', {})
// Check online status
if(statuses[0].status._ === 'userStatusOnline')
// Online
}
That's currently not possible with the Telegram Bot API.
In plus messenger , using bot login , relative last seen is shown.
Maybe you could ask them in their Official support group: https://t.me/plusmsgrchat (I'm blocked)
https://core.telegram.org/bots#4-how-are-bots-different-from-humans
Bots have no online status and no last seen timestamps, the interface shows the label ‘bot’ instead.

How to authorize google analytics API through API Key

I need to display the analytics of my site to all the users, but Using OAuth it displays the analytics of the sites configured for the logged in user. How can I implement a dashboard using embed API but showing my website analytics only?
The best possibility I can come up at is using API Key instead of Client ID, but I am unable to find a way to do it.
Does anyone have anything else in mind.
API keys are used for accessing public data, like the list of dimensions and metrics in the metadata API. In order to access private Google Analytics data you must use Oauth2.
So you don't want to use the API key, what you want to do is use a service account and then authorize the service account service-side, receive and access token from that authorization flow, and then pass that access token to the Embed API.
Here's a full working example:
https://ga-dev-tools.appspot.com/embed-api/server-side-authorization/

Google Analytics Api Inividual history

Can I get a history of a particular user(for example: all page view) using Google Analytics Api through Google Analytics cookie GA1.3.465646922.1425555945 or Client ID
ga(function(tracker) {
var
clientID = tracker.get('clientId'),
});
I use php library.
You will need to store the clientId (or the value of the cookie) in a custom dimension, then call the core reporting api including dimension1, pagePath and pageviews. However, if you have not stored these values in a custom dimension yet, I doubt you can do it for historical data