Google calendar login with web-bot - javascript

I am making a web-bot that checks every day if I have a new work in my time table.
If there is a new work date then it must add it to my Google Calendar.
But how do I login with the Google Calendar API, because the web page is not accessed by users. So how do I do that?

There is no Google API docs for web bots. However I found a Github repo called Telegram bot using Google Calendar API. This bot can interact with Google Calendar API, allowing you to easily add/manage events.
According to their page, this is currently up and running and you may use it:
https://telegram.me/google_calendar_bot
Also, since you're not going to use manual authorization from users, service accounts might be able to help you in the log-in part.

Related

Authenticating Google Calendar API from server to server directly using php

Background:
Creating a project where a user can create/edit/delete a calendar events on my calendar without the need to authenticate themselves. They can add or remove users on that calendar event. I have credentials to my google account to authenticate the requests. I want to talk directly to google calendar api without the need to insert username/password (which I can provide from the backend, if required).
Technology:
PHP7.0/ SQL SERVER/ JavaScript
Issue/Requirement:
I have created the project in Google and added credentials for "service account key". I have all the required keys for creating the project. How do I talk to the google server directly without using a frontend page or console and directly go ahead with creating an event?
Any suggestions welcomed. On a time crunch here.
How to quickly set up a PHP project using Google Calendar API: https://developers.google.com/calendar/quickstart/php
How to authenticate with a service account using Google APIs on PHP: https://github.com/googleapis/google-api-php-client#authentication-with-service-accounts
How to create events using the Calendar API using PHP language: https://developers.google.com/calendar/create-events#metadata
Using all the examples above you should be able to easily build yourself the solution you want.
Furthermore, I would suggest you check out the community guidelines on how to ask good questions.

How to show privacy policy URL and terms of service URL inside the Google one-tap UI for new users?

A few days ago, I noticed googleyolo client library was showing this message:
An UI change targeting on 5/18/2018 will show relying party's privacy
policy URL and terms of service URL inside the one-tap UI for new
users. If enabled, SHOW_RP_TOS can be found in
GOOGLE_ONETAP_EXPERIMENTAL_FEATURES array. To try this feature, append
'?e=1723232' to googleyolo client library URL.
When using https://smartlock.google.com/client?e=1723232 as googleyolo client library URL, I see no change in the one-tap UI.
Is there anything else that needs to be done to show Terms of Service URL in one-tap UI?
This feature is available for all sites now. If you don't see the links in the UI, check the following:
ensure you have supplied a privacy policy and/or terms of service link in the Google Developer Console for the OAuth project / client ID that you using in the API requests (under "consent screen" in the credentials section). Refer to the Getting Started guide for background.
verify that the active Google Account(s) has not already granted access to name/email address info via previous usage of one-tap or Google Sign-In button. You can check and reset this at https://myaccount.google.com/permissions
Also note that if you have multiple active accounts, you will need to select one before the blue button and legal text are shown. Please leave a comment if you have trouble.
Sorry that experiment didn't work. We'll be rolling out the changes this week, so you'll be able to see them. If you want to see the change on your site before it is rolled out, there is a google group (https://groups.google.com/forum/#!forum/yolo-web-testers) you can join and you'll see the notice.

Create event in google calendar api without login authentication

I have a customer that wants to do scheduled reservations for his beach house. My thought was to simply set up a Google Calendar and use the API to create and check "reservations" in the form of events. My issue is I cannot find a way to create events to a calendar without a user logging into Google, and even then, it will not add an event to an account other than the account currently logged in. I understand there is the option of a "Google Service Account", but I am trying to find an option that does not incur any extra cost.
Is it possible to develop a REST API to push requests to the desired Google account? That may sound absurd, I have just recently looked into routing a REST API, so I am still unaware of the function and limitations.
In case anyone needs the help in the future, I ended up using the "google service account" and granting it access to the individual user's calendar. Then all I had to do was send the form data through XMLHttpRequest. I am about to redo the the entire site, so I might update this again, but my approach is going to be about the same except swapping out XMLHttpRequests with fetch requests.

Simple way to display an existing Google Calendar in Rails and allow event booking without user sign in?

My client has me working on an Event booking/scheduling app in Rails. The user will come to the app's page, select an event and options, and then be displayed an existing Google Calendar that shows available dates and times.
Let's say they want to book Face Painting on November 15, 2016 from 1pm to 5pm, as an example.
I'm stuck here because my client does not want the user to sign in. So I think I'll have to use a session_id to (eventually) pass verified Stripe payment to Google Calendar and create an event on the existing Google Calendar.
I have it working up to the point where the user selects their Event and :event_options, but I don't know how to get the existing calendar events to show to the user and let them select their time/dates to finish booking.
Does anyone know the simplest solution to this problem?
Thank you!
Perform Google Apps Domain-Wide Delegation of Authority
In enterprise applications you may want to programmatically access users data without any manual authorization on their part. In Google Apps domains, the domain administrator can grant to third party applications domain-wide access to its users' data — this is referred as domain-wide delegation of authority. To delegate authority this way, domain administrators can use service accounts with OAuth 2.0.
For additional detailed information, see Using OAuth 2.0 for Server to Server Applications
Though it's not in ruby see this example tutorial by daimto Google Calendar API with PHP – Service Account
For getting the events use Events: list
Returns events on the specified calendar.
Then create a function to show a calendar like UI that will display the given list of events to the user.
Hope this helps!

integrating facebook chat using graph api

I have been asked to integrate facebook chat in my application using javascript. I went through the chat api but that needs a domain url. I have to integrate the chat without the domain or the site url. I tried populating the online friends list through graph api, and I am able to successfully authenticate using the client flow example, but it does not redirect to my local host: http://localhost:8090/chatplugin/success.html. An error pops up telling me the resource is not found.
Is it possible to integrate FB chat using the graph api? I'm new to FB apis and I need more info.
Thanks:)
Short answer: no.
Longer answer: The Graph API lets you access all the information that is stored in Facebook's social graph; the social graph is the giant web that keeps all the information on people, events, messages, etc. Chat isn't part of the graph, it's a separate application, that also uses info from the graph to populate it.
While there may be other ways to sneak around (which I don't know), the Graph api doesn't provide what you need.
Please see the API available on Facebook API.
https://developers.facebook.com/docs/chat/

Categories