通过Google Calendar API发送活动的电子邮件通知 [英] Sending email notifications for Events via Google Calendar API

查看:313
本文介绍了通过Google Calendar API发送活动的电子邮件通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 calendar.events.insert API通过PHP客户端将事件添加到我的日历中。
正确插入事件以及由API设置的适当值。
但是,同样不能触发电子邮件邀请给与会者。我环顾四周,发现请求需要将param sendNotifications 设置为 true
这同样也没有帮助。



以下是一个示例代码:

<$ p $ {$ b $calendarId:calendarData.id,
sendNotifications:true,
$ p> var request = gapi.client.calendar.events.insert end:{
dateTime:eventData.endTime
},
start:{
dateTime:eventData.startTime
},
summary:eventData.eventName,
attendees:jQuery.map(eventData.attendees,function(a){
return {'email':a};
}),
提醒:{
useDefault:false,
覆盖:[
{
method:email,
分钟:15
},
{
方法:弹出,
分钟:15
}
]
}
});

其中eventData和calendarData是适当的对象。



<尽管我的主要问题是第一次发送电子邮件邀请函,但我也尝试(如上所述)设置提醒(使用覆盖)。虽然弹出窗口按预期工作,但我在这种情况下也没有收到电子邮件更新。



这让我怀疑这是否是一个许可问题 - 这是我也许需要启用我的应用程序(用户可以理解地需要知道我的应用程序是否以他们的名义发送电子邮件)?

@linaa是正确的。刚刚碰到了这个问题。



在JS中,这看起来像:

  var request = gapi.client.calendar.events.insert(
sendNotifications:true,
{
//请求正文在这里
}
) ;


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 values as set by the API. The same however is not able to trigger an email invite to the attendees. I looked around to find that the request needs to set the param sendNotifications as true. The same doesn't seem to help either.

Here is a sample code:

var request = gapi.client.calendar.events.insert({
        "calendarId" : calendarData.id,
        "sendNotifications": true,
        "end": {
          "dateTime": eventData.endTime
        },
        "start": {
          "dateTime": eventData.startTime
        },
        "summary": eventData.eventName, 
        "attendees": jQuery.map(eventData.attendees, function(a) {
          return {'email' : a};
        }),
        "reminders": {
          "useDefault": false,
          "overrides": [
            {
              "method": "email",
              "minutes": 15
            },
            {
              "method": "popup",
              "minutes": 15
            }
          ]
       }
      });

Where eventData and calendarData are appropriate objects.

Although my main problem is with email invites being sent the first time, I also tried (as can be seen above) to set a reminder (using overrides). While the popup works as expected, I didn't receive an email update in this case either.

This makes me wonder whether this may be a permission issue - something which I need to enable for my app perhaps (the user would understandably need to know if my app is sending emails on their behalf)?

解决方案

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

这篇关于通过Google Calendar API发送活动的电子邮件通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆