Sending email notifications for Events via Google Calendar API

拟墨画扇 提交于 2019-12-01 17:38:58

@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
    }
);

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 () {});

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!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!