简体   繁体   English

发送谷歌日历 API 确认 email

[英]Sending Google Calendar API Confirmation email

I'm trying to make it so that once an event is created with Google Calendar API and an attendee is added, they will get a confirmation email.我正在尝试这样做,以便一旦使用 Google 日历 API 创建了一个事件并添加了一个与会者,他们就会得到一个确认 email。

Is this possible with the current Google Calendar API?当前的 Google 日历 API 可以做到这一点吗? (I'm using PHP for the back end ). (我使用 PHP 作为后端)。 I've tried with sendUpdates set to all and attendees[].responseStatus to needsAction but without any success.我尝试将sendUpdates设置为 all 并将attendees[].responseStatus .responseStatus 设置为needsAction但没有任何成功。

$event = new Google_Service_Calendar_Event(array(
  'summary' =>'something',
  'location' => 'something',
  'description' => $name.' test',
  'start' => array(
    // 'dateTime' => '2015-05-28T09:00:00-07:00',
    'dateTime' => $start.':00-04:00',
    'timeZone' => 'America/Toronto',
  ),
  'end' => array(
    'dateTime' => $end.':00-04:00',
    'timeZone' => 'America/Toronto',
  ),
  'attendees' => array(
    array('email' => $email),
    'responseStatus' => 'needsAction',
  ),
  'reminders' => array(
    'useDefault' => FALSE,
    'overrides' => array(
      array('method' => 'email', 'minutes' => 24 * 60),
      array('method' => 'popup', 'minutes' => 10),
    ),
  ),
  'sendUpdates' => 'all',
  'visibility' => 'public',
));

$calendarId = 'vladc99@gmail.com';
$event = $service->events->insert($calendarId, $event);
echo "<a href='".$event->htmlLink."' taget='_blank'> Click here </a>";
echo "<a href='../'>Home</a>"; 

Thank you in Advance先感谢您

sendUpdates is a request parameter, not an option of the request body sendUpdates是请求参数,而不是请求正文的选项

In other words it is not located inside the request body.换句话说,它不位于请求正文内。

Modify your code as following:修改您的代码如下:

$event = new Google_Service_Calendar_Event(array(
  'summary' =>'something',
  'location' => 'something',
  'description' => $name.' test',
  'start' => array(
    // 'dateTime' => '2015-05-28T09:00:00-07:00',
    'dateTime' => $start.':00-04:00',
    'timeZone' => 'America/Toronto',
  ),
  'end' => array(
    'dateTime' => $end.':00-04:00',
    'timeZone' => 'America/Toronto',
  ),
  'attendees' => array(
    array('email' => $email),
    'responseStatus' => 'needsAction',
  ),
  'reminders' => array(
    'useDefault' => FALSE,
    'overrides' => array(
      array('method' => 'email', 'minutes' => 24 * 60),
      array('method' => 'popup', 'minutes' => 10),
    ),
  ),
  'visibility' => 'public',
));

$calendarId = 'vladc99@gmail.com';
$event = $service->events->insert($calendarId, $event, array('sendUpdates' => 'all'));
echo "<a href='".$event->htmlLink."' taget='_blank'> Click here </a>";
echo "<a href='../'>Home</a>"; 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM