rebbailey
rebbailey

Reputation: 754

Rails: How to add a video call when creating a new Event through Google Calendar API

I am using the typheous gem to create a new Event through the Google Calendar API (V3). The response returns 200 and a Calendar Event is created. My question, is there a way to always create the Event with a video-call attached as well?

response = Typhoeus::Request.new(
        "https://www.googleapis.com/calendar/v3/calendars/calendarId/events",
        method: :post,
        body: {
                start: {
                  dateTime: Time.parse(split_time_range[0])
                },
                end: {
                  dateTime: Time.parse(split_time_range[1])
                },
                attendees: [
                  {
                    email: "#{ENV["my_email"]}"
                  }
                ],
                summary: "New Meeting"
              }.to_json,
        params: {access_token: session[:google_calendar_access_token], calendarId: "primary", sendNotifications: true},
        headers: {"Content-Type": "application/json"}
      ).run

Upvotes: 0

Views: 469

Answers (1)

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 117261

The Google Calendar event body does have a field called HangoutsLink

hangoutLink string An absolute link to the Google+ hangout associated with this event. Read-only.

As you can see this field is read only. I would try and send it when you are creating your event but i am not sure its something you can set with the API.

There is an issue logged for this Calendar API: Hangout not being added automatically to event when creating using the API. I have not been able to find the "automatically create a video call to a created event" setting which they speak of but its an old issue this may have been removed.

Upvotes: 2

Related Questions