Sending flight information to Microsoft Cortana with contextual awareness

Bing
 

Microsoft Cortana supports contextual awareness for airline flight scenarios. This article describes the markup requirements for sending flight data in e-mails to be read by Cortana.

Published date: April 2, 2014

Microsoft Cortana interprets schema.org markup in e-mails to extract airline flight reservation data, which it uses to provide a rich user experience as shown in UI overview of contextual awareness in Microsoft Cortana. This article describes the markup requirements for sending reservation confirmations to enable this experience.

System_CAPS_noteNote

Once Cortana receives the first flight confirmation mail with the required markup, it automatically tracks updates and other changes to the flight from that point forward. You do not need to send any further notifications.

Schema.org is a standardized vocabulary and data model for machine-readable semantic annotation. It uses a combination of classes and properties to describe things. Cortana can read schema.org information in Microdata and JSON-LD formats.

Microdata is a set of HTML5 attributes and an associated usage model for adding semantic information to HTML documents, including email. In Microdata, you set the value of an itemtype attribute to a Schema.org class, such as http://schema.org/Thing, and then describe one or more properties of that class by using the itemprop attribute with its value set to the name of a Schema.org property, such as “description”. The itemscope attribute associates children of the current HTML element with the current class. Microdata is the preferred option for adding Schema.org annotations in-line with the body of content in your email.

JSON-LD is a JSON-based syntax that describes the semantics of an HTML document within the scope of a <script> tag. In JSON-LD, you set the @context key to “http://schema.org”, set the @type key to the name of a Schema.org class, and then use Schema.org property names as the value of keys describing the properties of your typed objects. JSON-LD is a good option for representing semantics in the scope of a well-defined and consolidated JSON object.

For more information, see the schema.org documentation.

The following Schema.org classes and properties are used by Cortana in airline flight reservations. Classes are at the root level of the list, and their relevant properties are indented.

Note that Cortana uses a combination of proposed and adopted terms, and not all proposed terms are defined on the Schema.org web site.

  • FlightReservation: Proposed. Defines a flight reservation. This is the parent class for all flight data.

    • reservationNumber: Proposed. A unique identifier for the reservation.

    • reservationStatus: Proposed. A member of the ReservationStatusType enumeration that specifies if the reservation is confirmed, cancelled, on hold, or pending.

    • underName: Proposed. The Person for whom the reservation was made.

    • reservationFor: Proposed. The Flight being reserved.

  • Person: Defines a person.

    • name: The name of the person whose name will appear on the ticket.

  • Flight: Proposed. Defines the flight that was reserved.

    • departureAirport: Proposed. The Airport that the flight will leave from.

    • arrivalAirport: Proposed. The Airport that the flight will arrive at.

    • departureTime: Proposed. The date and time when the flight will depart, expressed in ISO 8601 format.

    • arrivalTime: Proposed. The date and time when the flight will arrive, expressed in ISO 8601 format.

    • provider: The Airline through which the flight was reserved.

  • Airport: Defines an airport.

    • name: The full name of the airport.

    • iataCode: Proposed. The standard three-letter IATA code designation for the airport.

  • Airline: Propsed. Defines an airline company.

    • name: The full name of the airline.

    • iataCode: Proposed. The standard two-letter IATA code designation for the airline.

The following example confirms a reservation for a one-way, non-stop flight from Seattle to New York City.

<div itemscope itemtype="http://schema.org/FlightReservation">
  <meta itemprop="reservationNumber" content="QWERT0123456789"/>
  <meta itemprop="reservationStatus" content="http://schema.org/Confirmed"/>
  <div itemprop="underName" itemscope itemtype="http://schema.org/Person">
    <meta itemprop="name" content="Estella Gallagher"/>
  </div>
  <div itemprop="reservationFor" itemscope itemtype="http://schema.org/Flight">
    <meta itemprop="flightNumber" content="123"/>
    <div itemprop="departureAirport" itemscope itemtype="http://schema.org/Airport">
      <meta itemprop="name" content="Seattle-Tacoma International Airport"/>
      <meta itemprop="iataCode" content="SEA"/>
    </div>
    <div itemprop="arrivalAirport" itemscope itemtype="http://schema.org/Airport">
      <meta itemprop="name" content="John F. Kennedy International Airport"/>
      <meta itemprop="iataCode" content="JFK"/>
    </div>
    <meta itemprop="departureTime" content="2014-04-02T10:32:00Z"/>
    <meta itemprop="arrivalTime" content="2014-04-02T11:45:00Z"/>
    <div itemprop="airline" itemscope itemtype="http://schema.org/Airline">
      <meta itemprop="name" content="Blue Yonder Airlines"/>
      <meta itemprop="iataCode" content="BY"/>
    </div>
  </div>
</div>
<script type="application/ld+json"> 
{ 
  "@context": "http://schema.org/", 
  "@type": "FlightReservation", 
  "reservationNumber": "QWERT0123456789",
  "reservationStatus": "http://schema.org/Confirmed", 
  "underName":{ 
    "@type": "Person", 
    "name": "Estella Gallagher"
  }, 
  "reservationFor": { 
    "@type": "Flight", 
    "flightNumber": "123",
    "departureAirport": {
      "@type": "Airport", 
      "name": " Seattle-Tacoma International Airport", 
      "iataCode": "SEA" 
    }, 
    "arrivalAirport": {
      "@type": "Airport", 
      "name": " John F Kennedy International Airport", 
      "iataCode": "JFK" 
    }, 
    "departureTime": "2014-04-02T10:32:00Z",
    "arrivalTime": "2014-04-02T11:45:00Z", 
    "airline": {
      "@type": "Airline", 
      "name": "Blue Yonder Airlines",
      "iataCode": "BY" 
    } 
  } 
} 
</script>

Each FlightReservation item describes a single, non-stop flight for a single passenger. A trip from Seattle to New York that changes planes in Chicago counts as two flights. For round trips, trips with multiple stops, or additional passengers, add additional FlightReservation objects.

The following example shows a one-way trip for two passengers with a layover.

<div itemscope itemtype="http://schema.org/FlightReservation">
  <meta itemprop="reservationNumber" content="QWERT0123456789"/>
  <meta itemprop="reservationStatus" content="http://schema.org/Confirmed"/>
  <div itemprop="underName" itemscope itemtype="http://schema.org/Person">
    <meta itemprop="name" content="Estella Gallagher"/>
  </div>
  <div itemprop="reservationFor" itemscope itemtype="http://schema.org/Flight">
    <meta itemprop="flightNumber" content="123"/>
    <div itemprop="departureAirport" itemscope itemtype="http://schema.org/Airport">
      <meta itemprop="name" content=" Seattle-Tacoma International Airport"/>
      <meta itemprop="iataCode" content="SEA"/>
    </div>
    <div itemprop="arrivalAirport" itemscope itemtype="http://schema.org/Airport">
      <meta itemprop="name" content="Chicago O'Hare International Airport"/>
      <meta itemprop="iataCode" content="ORD"/>
    </div>
    <meta itemprop="departureTime" content="2014-04-02T02:52:00Z"/>
    <meta itemprop="arrivalTime" content="2014-04-02T06:21:00Z"/>
    <div itemprop="airline" itemscope itemtype="http://schema.org/Airline">
      <meta itemprop="name" content="Blue Yonder Airlines"/>
      <meta itemprop="iataCode" content="BY"/>
    </div>
  </div>
</div>
<div itemscope itemtype="http://schema.org/FlightReservation">
  <meta itemprop="reservationNumber" content="ASDFG0987654321"/>
  <meta itemprop="reservationStatus" content="http://schema.org/Confirmed"/>
  <div itemprop="underName" itemscope itemtype="http://schema.org/Person">
    <meta itemprop="name" content="Estella Gallagher"/>
  </div>
  <div itemprop="reservationFor" itemscope itemtype="http://schema.org/Flight">
    <meta itemprop="flightNumber" content="456"/>
    <div itemprop="departureAirport" itemscope itemtype="http://schema.org/Airport">
      <meta itemprop="name" content="Chicago O'Hare International Airport"/>
      <meta itemprop="iataCode" content="ORD"/>
    </div>
    <div itemprop="arrivalAirport" itemscope itemtype="http://schema.org/Airport">
      <meta itemprop="name" content="John F. Kennedy International Airport"/>
      <meta itemprop="iataCode" content="JFK"/>
    </div>
    <meta itemprop="departureTime" content="2014-04-02T07:19:00Z"/>
    <meta itemprop="arrivalTime" content="2014-04-02T10:45:00Z"/>
    <div itemprop="airline" itemscope itemtype="http://schema.org/Airline">
      <meta itemprop="name" content="Blue Yonder Airlines"/>
      <meta itemprop="iataCode" content="BY"/>
    </div>
  </div>
</div>
<div itemscope itemtype="http://schema.org/FlightReservation">
  <meta itemprop="reservationNumber" content="ZXCVB0123456789"/>
  <meta itemprop="reservationStatus" content="http://schema.org/Confirmed"/>
  <div itemprop="underName" itemscope itemtype="http://schema.org/Person">
    <meta itemprop="name" content="Barney Desimone"/>
  </div>
  <div itemprop="reservationFor" itemscope itemtype="http://schema.org/Flight">
    <meta itemprop="flightNumber" content="123"/>
    <div itemprop="departureAirport" itemscope itemtype="http://schema.org/Airport">
      <meta itemprop="name" content=" Seattle-Tacoma International Airport"/>
      <meta itemprop="iataCode" content="SEA"/>
    </div>
    <div itemprop="arrivalAirport" itemscope itemtype="http://schema.org/Airport">
      <meta itemprop="name" content="Chicago O'Hare International Airport"/>
      <meta itemprop="iataCode" content="ORD"/>
    </div>
    <meta itemprop="departureTime" content="2014-04-02T02:52:00Z"/>
    <meta itemprop="arrivalTime" content="2014-04-02T06:21:00Z"/>
    <div itemprop="airline" itemscope itemtype="http://schema.org/Airline">
      <meta itemprop="name" content="Blue Yonder Airlines"/>
      <meta itemprop="iataCode" content="BY"/>
    </div>
  </div>
</div>
<div itemscope itemtype="http://schema.org/FlightReservation">
  <meta itemprop="reservationNumber" content="YUIOP0987654321"/>
  <meta itemprop="reservationStatus" content="http://schema.org/Confirmed"/>
  <div itemprop="underName" itemscope itemtype="http://schema.org/Person">
    <meta itemprop="name" content="Barney Desimone"/>
  </div>
  <div itemprop="reservationFor" itemscope itemtype="http://schema.org/Flight">
    <meta itemprop="flightNumber" content="456"/>
    <div itemprop="departureAirport" itemscope itemtype="http://schema.org/Airport">
      <meta itemprop="name" content="Chicago O'Hare International Airport"/>
      <meta itemprop="iataCode" content="ORD"/>
    </div>
    <div itemprop="arrivalAirport" itemscope itemtype="http://schema.org/Airport">
      <meta itemprop="name" content="John F. Kennedy International Airport"/>
      <meta itemprop="iataCode" content="JFK"/>
    </div>
    <meta itemprop="departureTime" content="2014-04-02T07:19:00Z"/>
    <meta itemprop="arrivalTime" content="2014-04-02T10:45:00Z"/>
    <div itemprop="airline" itemscope itemtype="http://schema.org/Airline">
      <meta itemprop="name" content="Blue Yonder Airlines"/>
      <meta itemprop="iataCode" content="BY"/>
    </div>
  </div>
</div>
<script type="application/ld+json"> 
[{ 
  "@context": "http://schema.org/", 
  "@type": "FlightReservation", 
  "reservationNumber": "QWERT0123456789",
  "reservationStatus": "http://schema.org/Confirmed", 
  "underName":{ 
    "@type": "Person", 
    "name": "Estella Gallagher"
  }, 
  "reservationFor": { 
    "@type": "Flight", 
    "flightNumber": "123",
    "departureAirport": {
      "@type": "Airport", 
      "name": " Seattle-Tacoma International Airport", 
      "iataCode": "SEA" 
    }, 
    "arrivalAirport": {
      "@type": "Airport", 
      "name": "Chicago O'Hare International Airport", 
      "iataCode": "ORD" 
    }, 
    "departureTime": "2014-04-02T02:52:00Z",
    "arrivalTime": "2014-04-02T06:21:00Z", 
    "airline": {
      "@type": "Airline", 
      "name": "Blue Yonder Airlines",
      "iataCode": "BY" 
    } 
  } 
},
{
  "@context": "http://schema.org/", 
  "@type": "FlightReservation", 
  "reservationNumber": "ASDFG0987654321",
  "reservationStatus": "http://schema.org/Confirmed", 
  "underName":{ 
    "@type": "Person", 
    "name": "Estella Gallagher"
  },
  "reservationFor": { 
    "@type": "Flight", 
    "flightNumber": "456",
    "departureAirport": {
      "@type": "Airport", 
      "name": "Chicago O'Hare International Airport", 
      "iataCode": "ORD" 
    }, 
    "arrivalAirport": {
      "@type": "Airport", 
      "name": " John F Kennedy International Airport", 
      "iataCode": "JFK" 
    }, 
    "departureTime": "2014-04-02T07:19:00Z",
    "arrivalTime": "2014-04-02T10:45:00Z", 
    "airline": {
      "@type": "Airline", 
      "name": "Blue Yonder Airlines",
      "iataCode": "BY" 
    } 
  } 
},
{
  "@context": "http://schema.org/", 
  "@type": "FlightReservation", 
  "reservationNumber": "ZXCVB0123456789",
  "reservationStatus": "http://schema.org/Confirmed", 
  "underName":{ 
    "@type": "Person", 
    "name": "Barney Desimone"
  },
  "reservationFor": { 
    "@type": "Flight", 
    "flightNumber": "123",
    "departureAirport": {
      "@type": "Airport", 
      "name": " Seattle-Tacoma International Airport", 
      "iataCode": "SEA" 
    }, 
    "arrivalAirport": {
      "@type": "Airport", 
      "name": "Chicago O'Hare International Airport", 
      "iataCode": "ORD" 
    }, 
    "departureTime": "2014-04-02T02:52:00Z",
    "arrivalTime": "2014-04-02T06:21:00Z", 
    "airline": {
      "@type": "Airline", 
      "name": "Blue Yonder Airlines",
      "iataCode": "BY" 
    } 
  } 
},
{
  "@context": "http://schema.org/", 
  "@type": "FlightReservation", 
  "reservationNumber": "YUIOP0987654321",
  "reservationStatus": "http://schema.org/Confirmed", 
  "underName":{ 
    "@type": "Person", 
    "name": "Barney Desimone"
  },
  "reservationFor": { 
    "@type": "Flight", 
    "flightNumber": "456",
    "departureAirport": {
      "@type": "Airport", 
      "name": "Chicago O'Hare International Airport", 
      "iataCode": "SEA" 
    }, 
    "arrivalAirport": {
      "@type": "Airport", 
      "name": "John F. Kennedy International Airport", 
      "iataCode": "JFK" 
    }, 
    "departureTime": "2014-04-02T07:19:00Z",
    "arrivalTime": "2014-04-02T10:45:00Z", 
    "airline": {
      "@type": "Airline", 
      "name": "Blue Yonder Airlines",
      "iataCode": "BY" 
    } 
  } 
}] 
</script>

For flights with multiple segments, Cortana offers to track each segment as a separate flight. If a customer books the same flight or set of flights for a group of passengers, Cortana tracks only the flights for one member of the group.

Show: