Search code examples
phpemailgoogle-schemas

Getting events automatically added to Google Calendar


I've made a site to manage workshops I run for improv comedy. I want the confirmation emails to automatically add events to Google Calendar.

The markup I include in my emails is validated at Below is the full original source of the email I've sent. It's been validated at https://www.google.com/webmasters/markup-tester/

I am using the "reservationStatus": "http://schema.org/Confirmed" This is as specified in the Google docs. I originally used the status "ReservationConfirmed" instead of just "Confirmed" since that's what schema.org seems to use (they don't have a 'Confirmed').

But neither 'ReservationConfirmed' or 'Confirmed' get added.

I've added ticket info, with TicketToken pointing to a correct QR code. I've added "performer" info (me, as the teacher) which is what Google EMail Markup Validator suggested.

I've also tested this by sending emails to myself (i.e. from [email protected] to [email protected]) which is supposed to bypass the need for an email to be whitelisted.

Delivered-To: [email protected]
Received: by 10.107.197.133 with SMTP id v127csp1379143iof;
        Thu, 21 Dec 2017 10:53:10 -0800 (PST)
X-Google-Smtp-Source: ACJfBoszCK5Q3Br9bFDOI7ucImZ8NGhK8yMVSfgRYzXWXmUjnZqrdWeFZtfiZgGGBqNTLHO6E66y
X-Received: by 10.107.199.131 with SMTP id x125mr14553462iof.70.1513882390523;
        Thu, 21 Dec 2017 10:53:10 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1513882390; cv=none;
        d=google.com; s=arc-20160816;
        b=mB5G7WFlPlD0EJjxARc9/MRoHHqtadwu83hRH6c6nIddN/4vwoNR3ASv+zr/5ER9RU
         Ys70NMGAZodF0lkVU40jByhV7rGiKA5h61kcC+JK2iR8X3QBBA/qcpxYDtwITAkQrqNc
         1+HEJ+kM3zboFJo8P1tUJYjKuucIRC+iQm/cLGYahf00vgIY+qeMbPXGmrKWMCR0Nl2l
         DItwZy25XrI54wO0joGt5zj1Gmxk2vPWX4Z7Y3PJsqUzc9sEZzHE7W68Ul2XKNS65CYO
         vgWwYXNuDYXeRM8kUIiEg9WuPv/Azzdj6clMDcwGLkXW5B3k76p4gNzr2uB4F6uZHJqu
         5gqA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=charset:mime-version:to:subject:reply-to:from:dkim-signature
         :message-id:date:arc-authentication-results;
        bh=dg0XGyowjh3py1SdZvxdclmUyhBEczAui/9SQr8hI6w=;
        b=n6Ej7Hv7uLnf3K61YP/6JhTBsMs/1JpwwS5dL+4XDHKOfgWfdkJW6nUaKrtyQimhk9
         vAmaVzJmNn9KdHH+31SeTACGHsX4aMwD0cgttIeNFL/HLTmucNWuzyGHW2I2Vt4ppsWt
         UI3NDAsc1LgkVw7E/MGo+z3IwGabYK9QIUNIg29uC9GK72cPhFonKoYzB+z4LrjG94xm
         w4NcWLu/rtciQy21YoertS1ahvGy0kPlMmv71mc6hW1Jt1HiEvpThMQag9y4Is8t9go/
         nJjkQvTYfxDFk4y/k6GEa1gbvuUEOsjtFELLxK6gcnCruMeUr9HPOdRfC8RLIEFg0Zjj
         d8+Q==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass [email protected] header.s=default header.b=L6X46Jgh;
       spf=pass (google.com: domain of [email protected] designates 72.52.242.236 as permitted sender) [email protected]
Return-Path: <[email protected]>
Received: from rocket-mail.gnservers.com ([72.52.242.236])
        by mx.google.com with ESMTPS id v9si13875880iog.60.2017.12.21.10.53.10
        for <[email protected]>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Thu, 21 Dec 2017 10:53:10 -0800 (PST)
Received-SPF: pass (google.com: domain of [email protected] designates 72.52.242.236 as permitted sender) client-ip=72.52.242.236;
Authentication-Results: mx.google.com;
       dkim=pass [email protected] header.s=default header.b=L6X46Jgh;
       spf=pass (google.com: domain of [email protected] designates 72.52.242.236 as permitted sender) [email protected]
Date: Thu, 21 Dec 2017 10:53:10 -0800 (PST)
Message-Id: <[email protected]>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
    d=willhines.net; s=default; h=Content-Type:MIME-Version:To:Subject:Reply-To:
    From:Sender:Date:Message-ID:Cc:Content-Transfer-Encoding:Content-ID:
    Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
    :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
    List-Subscribe:List-Post:List-Owner:List-Archive;
    bh=dg0XGyowjh3py1SdZvxdclmUyhBEczAui/9SQr8hI6w=; b=L6X46Jgh23/qgj8FXWHGGxiPKD
    uYRAMfjpclaKE6Z6uWLHrdU2KWvyeqtYF+P4tFwp83oNWqOV9cOfc1NmzAgKkUXojH4ek02MW3HgX
    HP5jVNrlDuQfbQooA1HIMjAgSGlY5KONujfIpZiV9h0N0PhiqiWpdXtzjMebpTP1PR8WmVchEYFNh
    6Bbl+ZLfEFqugo9SFvQtQWdUqKd2h+eNT6+/WH3lf/nowNpnOS0PZcLCXrWFllmlwpkjc23LDAcyP
    UV9pizZtTqxbXpgCy2pEZUTYfX4aiqVJ5+E291QQlVLrl0YhCTOrXmD8nSntqXpABVRKB4QyWsdBq
    ZdJ93biA==;
Received: from static-205-185-62-122.earthlinkbusiness.net ([205.185.62.122]:60727 helo=localhost)
    by rocket.gnservers.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128)
    (Exim 4.89_1)
    (envelope-from <[email protected]>)
    id 1eS5xu-0007m4-0b
    for [email protected]; Thu, 21 Dec 2017 13:53:10 -0500
From: [email protected]
Reply-To: [email protected]
Subject: ENROLLED: test - Mon Dec 25 - 11:00am-5pm
To: [email protected]
MIME-Version: 1.0
Content-Type: text/html
charset: iso-8859-1
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname - rocket.gnservers.com
X-AntiAbuse: Original Domain - gmail.com
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - willhines.net
X-Get-Message-Sender-Via: rocket.gnservers.com: authenticated_id: [email protected]
X-Authenticated-Sender: rocket.gnservers.com: [email protected]
X-Source: 
X-Source-Args: 
X-Source-Dir: 

<script type="application/ld+json">
 {
   "@context": "http://schema.org",
   "@type": "EventReservation",
   "reservationNumber": "wbhwk794",
    "reservationStatus": "http://schema.org/Confirmed",
   "underName": {
     "@type": "Person",
     "name": "Will Hines"
   },
   "reservationFor": {
     "@type": "EducationEvent",
     "name": "test",
     "startDate": "2017-12-25 11:00:00",
      "endDate": "2017-12-25 17:00:00",
     "performer": {
          "@type": "Person",
          "name": "Will Hines",
          "image": "http://willhines.net/home_files/wh_clay_med.jpg"
        },
     "location": {
       "@type": "Place",
       "name": "The Complex",
       "address": {
         "@type": "PostalAddress",
         "streetAddress": "6476 Santa Monica Blvd",
         "addressLocality": "Los Angeles",
         "addressRegion": "CA",
         "postalCode": "90038",
         "addressCountry": "US"
       }
     }
   },
    "ticketToken": "http://www.willhines.net/practices/code.php?wid=52&key=9ef66eb1f8166930&v=winfo",
    "ticketNumber": "1",
    "numSeats": "1",
   "modifiedTime": "2017-12-21 10:53:05",
   "modifyReservationUrl": "http://willhines.net/practices/index.php?wid=52"
 }
 </script>
<p>You are ENROLLED in test - Mon Dec 25 - 11:00am-5pm. </p>

<p>To DROP, click here:
http://localhost:8888/practices/index.php?key=9ef66eb1f8166930&ac=drop&wid=52<br><br>Pay in person or venmo. On the day of the workshop is fine.<br>Venmo link:
http://venmo.com/willhines?txn=pay&share=friends&amount=10&note=improv%20workshop</p>

<p>Full info:</p>

<p><b>Title:</b> test<br>
<b>When:</b> Mon Dec 25 - 11:00am-5pm<br>
<b>Where:</b> The Complex 6476 Santa Monica Blvd Los Angeles CA 90038<br>
<b>Cost:</b> 10</p>
<b>Description:</b> </p>






<p>Thanks!</p>

<p>-Will Hines<br>
HQ: 1948 Hillhurst Ave. Los Angeles, CA 90027</p>

Solution

  • In case anyone else runs into this, I "solved" it. Minor schema error, plus I had to register my email with Google.

    1) When the Google docs differ from what's said on schema.org, follow the Google docs. For me that meant defining the reservationFor @type as "Event" not "EducationEvent"

    2) You need to register your email with google as described here: Registering With Google

    Otherwise, tests will only work if you do them via script.google.com as described in Apps Script Quickstart.

    The docs say you can sidestep being registered for testing by having you email sent from and to the same address, but I was not able to get that to work.

    3) Also, and this is likely obvious, but I had my PHP code connect (Via PEAR's Mail) to a SMTP server where I had an account. This made sure my email had valid DKIM/SPF info.