Sending email notifications for Events via Google Calendar API

前端 未结 3 623
庸人自扰
庸人自扰 2021-01-18 05:14

I\'m using the calendar.events.insert API to add an Event to my Calendar via the PHP client. The event is being inserted correctly along with appropriate va

相关标签:
3条回答
  • 2021-01-18 05:18

    In the Google API Documentation for inserting events, the "sendNotifications" option is actually a parameter. You might want to put it in the request parameters instead of the body.

    In Meteor

    Note: In my Meteor application, I did did the request by hand, and I'm still new to JavaScript. I'm not sure how you would do that in plain JavaScript or with the calendar API, so I'll just put the Meteor code, hope it helps although it's a bit off-topic.

    var reqUrl = "https://www.googleapis.com/calendar/v3/calendars/primary/events";
    var payload = {
      'headers' : {
        'Authorization': "Bearer " + token,
        'Content-Type': 'application/json'
      },
      'params': {
        'sendNotifications': true
      },
      'data': {
        "summary": summary,
        "location": "",
        "start": {
          "dateTime": start
        },
        "end": {
          "dateTime": end
        },
        "attendees": [
          {
            "email": "*********@gmail.com"
          }
        ]
      }
    };
    Meteor.http.post(reqUrl, reqParams, function () {});
    
    0 讨论(0)
  • 2021-01-18 05:26

    For this you should set the "remindOnRespondedEventsOnly" value to "true".

    which means, Whether event reminders should be sent only for events with the user’s response status “Yes” and “Maybe”.

    You can find this information here.

    Hope that helps!

    0 讨论(0)
  • 2021-01-18 05:31

    @linaa is correct. Just ran into this issue myself.

    In JS, this would look like:

    var request = gapi.client.calendar.events.insert(
        sendNotifications: true,
        {
                  // request body goes here
        }
    );
    
    0 讨论(0)
提交回复
热议问题