Sending email notifications for Events via Google Calendar API

前端 未结 3 627
庸人自扰
庸人自扰 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 () {});
    

提交回复
热议问题