Google 日历活动创建发送通知

1 javascript google-calendar-api google-api

我想知道是否有人知道如何在谷歌日历中创建活动时通知与会者。当我手动创建事件时,我可以根据需要发送事件。但是当我使用带有 javascript 客户端库的 api 创建事件时。我没有收到电子邮件通知。

这是我的创建代码:

var request = gapi.client.calendar.events.insert({
    'calendarId': '***@***.com',
    'resource': resource
});
request.execute(function() {
});
Run Code Online (Sandbox Code Playgroud)

我的资源变量已定义,事件已成功添加到日历,但没有与会者收到任何邀请。如果我在创建活动后进入日历上的活动,参与者就在那里。

我在请求中遗漏了什么,以便与会者在创建时收到通知。

J. *_*ich 5

与会者数组有一个 responseStatus,您可以将其设置为: "needsAction" - 与会者尚未响应邀请。“拒绝” - 与会者拒绝了邀请。"tentative" - 与会者暂时接受了邀请。"accepted" - 与会者已接受邀请。

var request = gapi.client.calendar.events.insert({
  'calendarId': '***@***.com',
  'resource': resource,
  'attendees': [{'email':'example@example.com','responseStatus':'needsAction'}]
  }
});
request.execute(function() {
});
Run Code Online (Sandbox Code Playgroud)


小智 5

您必须将参数“sendNotifications”设置为 true。在这里您可以看到默认设置为 false。 https://developers.google.com/google-apps/calendar/v3/reference/events/insert