Automatically create calendar event from gmail

1.7k views Asked by At

I am using below code to schedule the calendar event but it is not working. I am able to get an email but calender event is not scheduled automatically.

mail_tamplate.html

<html>
  <head>
<script type="application/ld+json">
{
  "@context": "http://www.schema.org",
  "@type": "Event",
  "eventStatus": "https://schema.org/ConfirmAction",
  "name": "Rahul Kumar",
  "description": "Desc of event",
  "startDate": "2017-01-05T20:00",
  "endDate": "2017-01-05T21:00",
  "location": {
    "@type": "Place",
    "name": "South Ex",
    "address": {
      "@type": "PostalAddress",
      "streetAddress": "178-C",
      "addressLocality": "Meerut",
      "addressRegion": "Uttar Pradesh",
      "postalCode": "250001",
      "addressCountry": "India"
    }
  }
}
</script>
</head>
  <body>
    <p>
      This a test for a Go-To action in Gmail.
    </p>
  </body>
</html>

code.gs

function testSchemas() {
  var htmlBody = HtmlService.createHtmlOutputFromFile('mail_template').getContent();

  MailApp.sendEmail({
    to: Session.getActiveUser().getEmail(),
    subject: 'Test Email markup - ' + new Date(),
    htmlBody: htmlBody,
  });
}
1

There are 1 answers

2
Mr.Rebot On

AFAIK, this is not possible.

Actions enable users to interact with your product or service right inside Gmail and Inbox.

For instance, when a user receives an invitation to an event, she may be presented the option to RSVP interactively to the event from right inside the invitation. When she receives a notification that a magazine subscription is about to expire, she may be presented the option to renew it right from the notification.

Actions can be declared in two ways: as In-App Actions or as Go-To Actions. Multiple types of actions are currently supported.

RSVP Action

  • A RsvpAction can be used for responding to an event invitation from inside the inbox. The inbox renders this action by showing the details of the event and a combination of Yes/No/Maybe responses defined by the sender.

enter image description here

Interaction with the user is needed before the event is added. Hope this helps.