Move google calendar event to another person calendar - google-calendar-api

How to move Google calendar event to another person calendar? I tried with Google move API but Unfortunately I am getting 404 not found error.
reference: https://developers.google.com/google-apps/calendar/v3/reference/events/move
Any Idea on this?

To perform move, the authenticated user needs to have at least write access to both, source and target calendars.

*Solution*:- For Moving Calendar Event from One calendar To another or Change Organiser.
Using ACL API:
Call Acl API with Targeted Email by passing the fields,
calendarId: Primary,
scope:{
type: user,
value: Source EmailId
}
Using Move API:
Call move Api with Source Email by passing the fields,
calendarId: Primary,
eventId: "",
destination: Targeted Email Id
So It will move to Destination Email Calendar.
Thank you.

Related

Firebase custom verification email

I read some other posts about this topic but couldn't finally figure out how to accomplish this.
I want to send the email-verification email normally send from firebase itself from my own email-provider (like mailjet e. g.) The reason is that I want to customize the email text etc.
I also read about creating a custom email handler which I would do too. But this just handles the action that happens when the user clicks on the link in the email.
At the moment I call this from my flutter app after the users sign up:
user.sendEmailVerification();
this makes firebase send the standard verification email to the user. Instead of doing that I'd need to send the email myself. But like seen here I need to have this oobCode generated. to generate a correct link to handle. I just can't find an example on how to do that. What would be the right approach to send the email myself? Maybe I just did not find the right resource. Thanks a lot.
You need to generate and send the email via a backend, by using the Admin SDK. The easiest is to use a Cloud Function, from which you use the Mailjet NodeJS API wrapper.
So, in the Cloud Function, you need to:
Call the generateEmailVerificationLink() method of the Admin SDK, which returns a link
Generate an email containing this link
Send the email to the user (see the Mailjet NodeJS API wrapper documentation)
The first steps are detailed here in the doc.
In order to customize the URL of the verification link (e.g. you want to redirect to https://www.myrapp.com/emailVerifyScreen) you need to change the base URL as shown in the below image ("Customize action URL"). Also explained here in the doc.
Then, when the user clicks on the link in the email he/she has received, you need to do what is explained in the doc you referred to in your question: Create custom email action handlers. See the point #4 "Handle email address verification by calling applyActionCode".
Concretely, in the page of your app https://www.myrapp.com/emailVerifyScreen, you get the query string values from the URL (e.g. var actionCode = getParameterByName('oobCode');) and you use these values to call the applyActionCode(actionCode) method. When the promise returned by this method is fullfilled, you know that the email has been verified.
var actionCode = getParameterByName('oobCode');
auth.applyActionCode(actionCode).then((resp) => {
// Email address has been verified.
// TODO: Display a confirmation message to the user.
// You could also provide the user with a link back to the app.
// TODO: If a continue URL is available, display a button which on
// click redirects the user back to the app via continueUrl with
// additional state determined from that URL's parameters.
}).catch((error) => {
// Code is invalid or expired. Ask the user to verify their email address
// again.
});
One last point to note: you cannot directly get the oobCode alone. The generateEmailVerificationLink() method generates the full URL.
The answer mentioned above is absolutely correct , I am just adding to that how you can create action url in two ways for testing and then deployment way.
1> for custom email action handler you would have to create your own handlers (using HTML and js , react app , flutter anything you want) after doing that you can either test your handler by routing traffic to it (localhost) using ngrok(that will provide you with https url to route traffic on localhost, preferred method for testing) , or you can deploy it and directly use that url . now with that url go to firebase(your project) -> authentication -> templates -> use whatever handler you want( example reset password or email verification) -> edit and add custom action url to route traffic to your handler( hosted(deployed) or local(ngrok routing) .

GA Custom Event with User-ID triggered thru the API, Views question

I have this scenario.
I have User-ID feature enabled in my GA with session unification ON.
Inside my app when user logging I push userId to dataLayer and then I publish the custom event.
Inside my "All View" I can see 2 users witch is good (since merging still did not happen) and inside my User-ID View I can see just user with set User-ID
Now, the thing I noticed is that when the custom event that is published from the client is showing in both Non UserID and UserID Views.
But when I publish Custom Event from the Server thru the API, With only passing User-ID That event is only showing inside User-ID View.
My question is is this expected? Or should I publish the Event from the Client directly through API with User-Id, or Session Unification will do the job and I'll only have 1 event showing instead of two, meaning that it will figure out that Event is actually associated to that specific User?
Thanks!
Seeing the endpoint you are using the problem is definitely due to the fact that you are sending only the uid parameter and not the cid as well.
In order for the hit to be successful, only one of the two uid or cid parameters can be sent, however by sending only the uid the hit will be shown only in the User-ID view.

Redirect to Google Calendar Add Event

Is there a simple way where i could use Javascript to let user to add system's events to their Google Calendar event? What i need to accomplish here is, when the user clicks on the event on the calendar, there will be a popup that prompt user to sign in to Google (OAuth 2.0), and then the user will be redirected to the Google page for creating event. While the event's data that the user will add, is sent through Javascript. I use Fullcalendar from https://fullcalendar.io/js/fullcalendar-3.6.1 .
I have already go through the fullcalendar.io docs and i cannot found how to do this.
Any link for my reference? I need that API from Google that allow me to do this.
It is not a complete solution but a simple redirect to the google calendar page with path params might be helpful.
https://calendar.google.com/calendar/u/0/r/eventedit?dates=20210528T065000Z/20210528T070000Z&text=cool+event
this will open google calendar UI with your date and event details.

Authenticate Google Calendar on API.AI with Google Actions

I am writing an API.AI app with Google Actions (will run on google assistant and google home). The app should be able to read\add events to the user's google calendar account.
The backend is Google Cloud Functions, and I enabled the Calendar API in the developers console.
The flow the user should experience is something like this:
User: "Hey Google, when was my last meeting with Anna?"
Agent: "Your last meeting with Anna was two days ago"
User: "Set a meeting with Anna for the tomorrow"
Agent: "Ok. Meeting is set"
How should I build the authentication process to grant the app access to the calendar?
Update, 8 Nov 2017
As of about 4 October 2017, Google updated their policy to explicitly forbid this. Around the same time, they also took technical measures to prevent this.
The portion about enabling the Calendar API is still correct, although insufficient to do what the original question asked.
Original Answer
Broadly speaking, the auth tasks you need to do are in four parts:
Configure your project (in the cloud console) so that the Calendar API is enabled and that the OAuth2 client is correctly configured.
Configure the Action for account linking in the action console.
Configure the Actions on Google Integration for your API.AI Agent to indicate that sign-in is required.
When API.AI calls your webhook to fulfill an Intent, it will include an auth token as part of the JSON. You can use this token to make calls to the Google APIs you need.
Configure Cloud Project
You need to configure your cloud project so that it has access to the Google APIs you need and setup the OAuth2 Client ID, Secret, and Redirect URI.
Go to https://console.cloud.google.com/apis/dashboard and make sure you have the project you're working with selected. Then make sure you have the APIs you need enabled. (In this case, the Calendar API)
Select the "Credentials" menu on the left. You should see something like this:
Select "Create credentials" and then "OAuth client ID"
Select that this is for a "Web application" (it is... kinda...)
Enter a name. In the screen shot below, I used "Action client" so I remember that this is actually for Actions on Google.
In the "Authorized Redirect URIs" section, you need to include a URI of the form https://oauth-redirect.googleusercontent.com/r/your-project-id replacing the "your-project-id" part with... your project ID in the Cloud Console. At this point, the screen should look something like this:
Click the "Create" button and you'll get a screen with your Client ID and Secret. You can get a copy of these now, but you can also get them later.
Click on "Ok" and you'll be taken back to the "Credentials" screen with the new Client ID added. You can click the pencil icon if you ever need to get the ID and Secret again (or reset the secret if it has been compromised).
Configure the Action Console
Once we have OAuth setup for the project, we need to tell Actions that this is what we'll be using to authenticate and authorize the user.
Go to https://console.actions.google.com/ and select the project you'll be working with.
In the Overview, make your way through any configuration necessary until you can get to Step 4, "Account Linking". This may require you to set names and icons - you can go back later if needed to correct these.
Select the Grant Type of "Authorization Code" and click Next.
In the Client Information section, enter the Client ID and Client Secret from when you created the credentials in the Cloud Console. (If you forget, go to the Cloud Console API Credentials section and click on the pencil.)
For the Authorization URL, enter https://accounts.google.com/o/oauth2/v2/auth
For the Token URL, enter https://www.googleapis.com/oauth2/v4/token
Click Next
You now configure your client for the scopes that you're requesting. Unlike most other places you enter scopes - you need to have one per line. (In this case, you'd also add the correct scope you need to access the user's calendar.) Then click Next.
You need to enter testing instructions. Before you submit your Action, these instructions should contain a test account and password that the review team can use to evaluate it. But you can just put something there while you're testing and then hit the Save button.
Configure API.AI
Over in API.AI, you need to indicate that the user needs to sign-in to use the Action.
Go to https://console.api.ai/ and select the project you're working with.
Select "Integrations" and then "Actions on Google". Turn it on if you haven't already.
Click the "Sign in required for welcome intent" checkbox.
Handle things in your webhook
After all that setup, handling things in your webhook is fairly straightforward! You can get an OAuth Access Token in one of two ways:
If you're using the JavaScript library, calling app.getUser().authToken
If you're looking at the JSON body, it is in originalRequest.data.user.accessToken
You'll use this Access Token to make calls against Google's API endpoints using methods defined elsewhere.
You don't need a Refresh Token - the Assistant should hand you a valid Access Token unless the user has revoked access.
If you're using Google Sign-in as your login provider, you can request access to the calendar scope as part of your OAuth flow.
The public policy states:
"Don't request any OAuth scope from Google unless the user is signing in to your service using Google Sign-In."

How do I access other users calendars with google calendar v3?

I am using the Google Calendar (v3) API, with google apps and am wanting to use a single oauth2 credential to determine what users are free/busy at any given point.
I am wanting to use this:
https://developers.google.com/google-apps/calendar/v3/reference/freebusy/query
But to use this I need to get all the calendar ids for all the users. I cannot do this as the java client for the google calendar can only retrieve calendars of the user who owns the credential.
Note: I have access to all the users through the provisioning api.
Any help would be much appreciated as I am totally blocked by this.
For primary calendars, the calendarId is the user's email address. The authenticated user will also need to have permission to access the calendar. If you're using the Provisioning API then I'll assume you are a super admin, and super admins can access every calendar on their domain.
The specific query you are trying to do takes a list of calendarIds to query as a JSON list. If you are only concerned about primary calendars, then set each user's email as an id like this:
"items": [
{
"id": "user1#example.com"
},
{
"id": "user2#example.com"
}
]
In 2013, I took about a week to integrate with Google Calendar.
There were several steps:
ESTABLISH CREDENTIALS
GET CALENDAR OWNER AUTHORIZATION
RETRIEVE AUTHORIZATION CODE
REQUEST TOKEN
RETRIEVE TOKEN
GET CALENDAR ID
UPDATE THE TOKEN
RETRIEVE CALENDAR ENTRIES
I described the steps in more detail in 2013, now web archived here: https://web.archive.org/web/20130215064337/http://www.tqis.com/eloquency/googlecalendar.htm#DOC77

Resources