Inbox: Manually Create Trips

Update 2/24/17: Big news for those that travel by Train or Bus. As of today, Inbox by Gmail can now parse Train reservations and Bus reservations into its own trip. In addition, they can also be added to existing trips and the trip summary card will be updated accordingly. But if for some reason a trip is not created, you can use the scripts below to manually create the trips.

Also, please note this is for trips created today. They will be adding existing reservations to trips over the coming weeks. 

I have not updated the video below, however I have added files to the repository for Train Reservations and Bus Reservations in case you need to manually create a trip for some reason.

<<<<<End Update>>>>>



Thanks to a skillful Inbox user, I have learned how to manually create trips in Inbox by Gmail. As you all know, the Inbox team has not included to capability of manually creating a trip, however using Google Scripts, this is possible. I know, using Google Scripts sounds a bit scary, but it really is simple, and I have tried lay out the instructions as simple as possible. Please watch the video below to discover how to accomplish this.  Links to files referenced in the video can be found below as well as in the video description.



Please note, its not included in my video, but there is also a file below to use for dinner reservations. 








Code.gs: https://drive.google.com/open?id=0B6s6FNeXJ2Nfc3RXTGxPaHRkeW8

flight.html: https://drive.google.com/open?id=0B6s6FNeXJ2NfdGM0V2p4bDg5WDA
hotel.html: https://drive.google.com/open?id=0B6s6FNeXJ2NfMm9yTDBLZ3lacGM
autorental.html: https://drive.google.com/open?id=0B6s6FNeXJ2NfUzd1SXMwcXNidlk
reservations.html: https://drive.google.com/open?id=0B6s6FNeXJ2NfeXVha0FsaldQS00
trains.html: https://drive.google.com/file/d/0B6s6FNeXJ2NfX3l3YjcyRTZCdVU/view?usp=sharing
bus.htmls https://drive.google.com/file/d/0B6s6FNeXJ2NfZTU4bllITjFCTm8/view?usp=sharing

IATA Airport Lookup: http://www.iata.org/publications/Pages/code-search.aspx












Share on Google Plus

About Scott Greenstone

Google Top Contributor and Mentor; Healthcare IT Professional; https://plus.google.com/+ScottGreenstone

139 comments:

  1. Thank you for this! I've used it a couple times already. Easy to use even for a non-programmer.

    ReplyDelete
  2. Warning I followed this guide. Everything went well and it worked. However 2 days later I found the trip had disappeared and all the emails in it were in the Bin. Fortunately I noticed and was able to rescue them. YMMV.

    ReplyDelete
    Replies
    1. That is a known issue with trips, not related to this post. It happens on other trips as well

      Delete
  3. That might be the case but it's very annoying for a trip weeks in advamce to have all the emails related deleted. Could cause serious logistic problems.

    ReplyDelete
    Replies
    1. Agreed, that is why the more people that report this using feedback the better

      Delete
  4. Have you found a way to include restaurants and custom events?

    ReplyDelete
    Replies
    1. Add this file to your script: https://drive.google.com/open?id=0B6s6FNeXJ2NfeXVha0FsaldQS00

      Change the script to use reservations.html

      Delete
  5. Scott, if i'm not mistaken the hotel link actually leads to the reservation (it has the FoodEstablishment code instead of the LodgingReservation code).
    Thanks for the tip.

    ReplyDelete
    Replies
    1. Sorry was playing around with something. Its fixed now and set for hotel

      Delete
    2. Thanks, you might also be interested to know that there is a new code avaible to manually add events.
      The code is avaible here: https://developers.google.com/gmail/markup/reference/event-reservation
      Works fine, i just managed to manually add a Bruce Springsteen concert event to my Inbox :-)

      Delete
    3. Thanks I will put that together as well. Although I have not heard of any issues with people having events created.

      Delete
    4. Not all of the hotel reservation or events booking emails are sent with the correct email markup code that Inbox needs to create trips and events bundles.
      For example: all the emails i received for my Bruce Springsteen shows this summer didn't, but using your usefull tip i can have them added to my Inbox if i need.

      Delete
  6. Hmmm... I must have missed something. I followed the video to a T, ran code.gs to generate a hotel reservation, and received the email in Inbox. The email looks to be properly marked up but after 30 minutes, a Trip still has not been generated. Any ideas what I might have missed?

    ReplyDelete
    Replies
    1. In some cases it can take a while (couple hours)

      Delete
    2. You were right Scott, a couple of hours was necessary. Thanks!

      Now if we could just get support for Trains. :-)

      Delete
    3. Unfortunately there currently is no markup language for trains available yet

      Delete
  7. Hi Scott, great post! I was looking for a way to manually create trips for a while before I came across this. I adapted your script and was able to implement a simple form in Google Apps Script as a front-end. I travel a lot for work and don't always get reservation emails that Inbox recognises, so this will be really useful. In case you or your readers are interested, I've put the code on [GitHub](https://github.com/richardtguy/trip-maker) and published the script as a [web app](https://goo.gl/grOK2u).

    ReplyDelete
    Replies
    1. Thanks Richard - glad you found it and it helped. I am curious, how is what you put together different from what I put together?

      Delete
    2. The back-end is basically identical, but I wanted to have a more friendly interface as I think I'll use it quite a bit. I tried using the Gmail API instead of GAS, but I couldn't make it send emails with the authentication that Inbox requires to accept the structured data for reservations. So I gave up and used GAS to build a form using client-side JavaScript, then send the reservation details as a JSON object to the server-side script that finally calls the MailApp.sendEmail. This was a steep learning curve for me as it took a while to understand the difference between client and server-side scripting in GAS. Neat once I got the hang of it though - thanks for the inspiration!

      Delete
    3. Richard - Does your script only do the hotel reservation for trips? I saw a header for Event, but there were no input boxes.

      Delete
  8. This comment has been removed by the author.

    ReplyDelete
  9. Hi,
    Can you please explain the times in the flights code ?
    I can see there are 4 fields for times, what each means ?

    ReplyDelete
    Replies
    1. In my files there are only 2 dates/times 1 for arrival and 1 for departure

      Delete
    2. The template is as follows :
      2017-02-04T20:15:00-08:00
      2 times are mentioned, 20:15:00 & 08:00, same for arrival.
      Thanks !

      Delete
    3. Isn't the -08:00 the GMT offset?

      So in this case it would be February 4th 2017, 8:15 PM Pacific Standard Time.

      Delete
    4. I see what you are talking about and yes I think that is the GMT offset, although i did not change that at all when changing the time in my trips.

      Delete
  10. Yes, it is the time zone offset..
    Here is more info:
    https://www.w3.org/TR/NOTE-datetime

    Thanks!

    ReplyDelete
  11. This might not be a good question...but why can't I open the code.gs file? I'm hoping to open it and copy the contents, but I can't get it to work. I'm using Chrome browser. Thanks for this tutorial! I need to get back a trip I accidentally deleted...

    ReplyDelete
    Replies
    1. You need to download it and open it with an editor application

      Delete
    2. Thanks :)

      I had a feeling that question had an easy answer...I went through the tutorial and received the new emails in my Inbox. The trip hasn't bundled yet, but I'm hoping it will after some time. Thanks!

      Delete
    3. What editor application should I use? Very inexperienced user here, Thanks

      Delete
    4. You can use Google Scripts, or just use docs to type everything up and then copy to GOogle Scripts

      Delete
    5. Thank you Scott I figured that part out. Now getting this when I RUN the script.
      Appears on Flight.gs when I run the script
      Syntax error. (line 5, file "Flight")

      Appears on Code.gs when I run the script
      No HTML file named flight was found. (line 2, file "Code")

      Any advice? Thanks

      Delete
    6. Figured it out. I was naming the script flights not flight. Thanks for coming up with this useful script

      Delete
    7. Cool - glad you got it figured out

      Delete
  12. Using EventReservation...
    https://developers.google.com/gmail/markup/reference/event-reservation

    How would one take advantage of subEvents...
    https://developers.google.com/schemas/reference/types/Event

    For say a 2 day conference (BusinessEvent) and Agenda to work with Trips...

    7:15 AM Pre‐Conference Registration / Continental Breakfast
    7:45 AM Pre‐ Conference Tracks
    9:30 AM Conference Registration / Continental Breakfast
    10:30 AM Welcome / Key Note Presentation
    12:00 PM Lunch Buffet / Networking

    Thanks for your time,
    Scott

    ReplyDelete
    Replies
    1. I do not think you can, however take a look at the markup code, maybe you can figure it out? But i dont see anything there similar

      https://developers.google.com/gmail/markup/reference/event-reservation#cancel_a_event

      Delete
    2. I have been trying. I'm not finding much info on them and not even sure where to insert them or what the minimum required info is needed for each subevent.

      Thanks for the quick response though.

      Delete
    3. To be honest I am not sure its possible. I have never seen any show up like that in my inbox.

      Delete
  13. Hi, thanks for your post!!! Is it possible to add a ferry reservation?

    ReplyDelete
  14. Hmm... so i had an itinerary come from my airline.. that automatically created a trip. I had to cancel the itinerary as i had some changes; so i also deleted the trip. Then i rebooked the flight, same time same flight - google didnt create that as a trip.
    Tried to create that manually but it doesnt work now, i can create one manually for a different date but not for the same date that i had deleted.
    Any ideas anyone?

    ReplyDelete
    Replies
    1. Give it a day or so - there has been a delay of trips getting created

      Delete
    2. Thanks Scott; though the one i created with a different date span created within minutes

      i'll run a script and leave it a few days and see if that creates it

      appreciate the work you have put in here btw :)

      Delete
  15. I'm looking for a way to add a cruise to my trips folder though Inbox. Might you have any idea on how to create that?

    ReplyDelete
    Replies
    1. There is no markup email for cruise ships or trains at this time

      Delete
    2. That's kinda what I thought. Thanks for all the tips and tricks! :)

      Delete
    3. I just used the hotel.html as a template to create a cruise.html and modified the name, booking number, address of the port, and departure and return dates to fill in the appropriate fields. Then in the code.gs change to var htmlBody = HtmlService.createHtmlOutputFromFile('cruise').getContent();

      This worked like a charm. I have a cruise trip bundle now. There is a lot more information that could be included but this is a great start for bundling all of my cruise emails together.

      Thanks for the tutorial Scott!

      Delete
  16. This comment has been removed by the author.

    ReplyDelete
  17. Hey Scott. I used your scriot today to create emails for an upcoming trip to NY. I have two flights and a hotel stay. It produced the emails and cards for the flights and hotel stay, but hasn't bundled them into a trip. Its been several hours. Any thoughts?

    ReplyDelete
    Replies
    1. Hey Kyle, give it up to 3 days for it to create. I have seen it take that long, sometimes quicker.

      Delete
    2. I'll give it a few more days. What's funny is I had another hotel confirmation come across today and created a trip for that within minutes.

      Delete
  18. Replies
    1. quick tip -
      I used YOUR flight details, only changed the dates to 2015 and sent the email.
      it created trip to Oslo, and now I just added to this trip the actual flight confirmation i have and trashed the email for Oslo. the Trip details were changed right away :-)

      now let's see if the system will trash it like it happen to others.

      Cheers!!

      Delete
    2. Interesting workaround Dotan, will be curious to see what happens (hopefully only good stuff)

      Delete
  19. Excellent thank you! I'm no coder and you're instructions were easy for me to follow (thankfully!). I only added one "hotel" to the code though then just manually added my other email booking confirmations once the trip created itself in inbox - I may be missing something but unsure why you need to add each individually to the script emails rather than just forcing one instance of the trip you need? All worked well anyway so thanks :)

    ReplyDelete
    Replies
    1. Glad it helped you. Not sure why hotels and flights and cars need to be separated, but that is how it works for now

      Delete
  20. Does not work for me. Even if I try exactly your files I just get normal emails without cards. Maybe because I am using GApps for Work?

    ReplyDelete
    Replies
    1. Give it up to 3 days to create the trip. There have been times for me where it has take that long for the trip to create

      Delete
    2. Yes, but at least the cards should appear instantly like in the video?

      Delete
    3. The cards can take a few hours as well.

      Delete
    4. Ok. I just thought they show up immediately like they did in your video

      Delete
    5. Just as feedback: With my second google account (not used with gapps) everything worked perfectly. So it seems to be not working on accounts with gapps.

      Delete
  21. Hi Scott,
    I've copied things exactly as you have them, but I keep getting error messages. I run this code:

    function CreateTripBundle() {
    var htmlBody = HtmlService.createHtmlOutputFromFile('hotel').getContent();
    MailApp.sendEmail({
    to: Session.getActiveUser().getEmail(),
    subject: 'Hotel confirmation - Santa Barbara' = new Date(),
    htmlBody: htmlBody,
    });
    }

    Error message: Invalid assignment left-hand side. (line 1, file "Code")

    Is there something I was supposed to include that I don't see in your code?

    Thanks!

    ReplyDelete
    Replies
    1. You did make some changes and that could be the cause. For one you changed the name of the Function in the first row, but I dont think that should be a problem. Also in the line with the hotel confirmation it says = new Date(), it should be a plus sign not an equal sign.

      You should consider following the steps exactly and copy things exactly and only change the pieces as instructed.

      Delete
  22. Hi, Scott.
    Your script succesfully created a flight confirmation email in inbox, but is still not(have been 4days) ctreating a new trip. I have also tried to delete all the acutal reservation emails and re-forward it. Do you think there will be something else I could try?

    ReplyDelete
  23. I cant think of anything else. it should work and does for me. The only thing I can think of is give it a little more time

    ReplyDelete
    Replies
    1. I ran the script without any change(your original with OSLO) and it created a trip. I am trying to bundle other reservation emails into OSLO trip and see if it changes trip inormation.
      I remembered that I have once deleted a trip in order to make a new one because it didn't have the correct information. Do you think this might somehow making inbox to think as unwanted trip information or something?

      Delete
    2. Unlikely as I have deleted trips and then was able to recreate them. The trip information wont change after the initial card is created, it will just add the information into the bundle

      Delete
  24. Hi, How to add person 2? and terminal?

    ReplyDelete
    Replies
    1. See here for all the ways you can add to the email setup
      https://developers.google.com/gmail/markup/reference/flight-reservation

      Delete
  25. Hi Scott,
    This is excellent information :-) Thanks for sharing.

    I wonder if you know more about the robot processing this. Lately, I seem to be getting more and more problems.

    I just tried adding one missing flight to a trips bundle, and this resulted in the robot adding more than 20 other flights, both in the past and in the future, screwing up everything. (A trip from November 2015 to September 2016).

    I'm repeatedly giving feedback within Google Inbox, requesting a manual way to manage trips, where the robot fails, but has (of course) not received any response.

    So any info on this would be appreciated.

    Br
    John Erik

    ReplyDelete
    Replies
    1. I dont know much more than what is here. How did you add the one missing flight? Was it through these scripts or did you already have the email

      Delete
  26. Hello Scott,

    Thanks for your great job!

    While i'm testing it on my Google Apps for Work account (trip creation seems to be quicker in regular account ?!?! but it's not the purpose)
    I found a train reservation schema (and some more like bus reservation) here: https://developers.google.com/schemas/reference/train-reservation.
    I hope it could help you to complete your post.

    (I found it thanks to the Google Structured Data Markup Helper: https://developers.google.com/gmail/markup/testing-your-schema)

    ReplyDelete
    Replies
    1. Thanks for this - I am going to test it out and update the post

      Delete
    2. Lionel, I tested this out, it does in fact create a card in Inbox, but after 2 days it still has not created a Trip. So there is something else needed for that to happen.

      Delete
  27. Hi Scott.

    Unfortunately this great trick is no longer working, Sep. 2016. Is there anything I should change/tune in the initial scripts? Because, initially, this August It did work...

    Thanks for your great job!
    RB

    ReplyDelete
    Replies
    1. I just tested this out and it created a trip no problem. Make sure everything is correct in your versions of the script

      Delete
  28. Hello Scott -

    Back in August, I used the scripts to create 2 flights (departure and return) with 1 connection (i.e. 2 legs) for each flight. It worked great and created the flights and they got bundled together for a trip just as expected. Recently, when I went to locate my Trip it was gone, but I still have the emails and the flights (with lovely city pictures) in my Inbox. Has something happened recently with a Inbox update that has prevented these from being stored as a trip? Will I have to start over again?

    Thanks,
    Corinne

    ReplyDelete
    Replies
    1. Nothing has changed that I am aware of. You can try to forward the emails to another account, delete them, then forward back to see if a trip gets recreated.

      Delete
  29. Weird... I can't open the code.gs file on google drive...
    is there a way to copy and paste it directly on here?

    ReplyDelete
    Replies
    1. function manuallyCreateTrips() {
      var htmlBody = HtmlService.createHtmlOutputFromFile('flight').getContent();

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

      Delete
  30. Hi Scott,

    Thanks very much for this great tutorial, it works like a charm here in Austria as well. :) Looking forward to an update for trains when this function becomes available!

    Cheers from Vienna,
    Wolfgang

    ReplyDelete
  31. It worked for me. Also, I managed to get a more useful email by opening the unrecognized email and coping the the html of it.
    I just pasted after the (/script)
    Something like that:

    [/script]
    [html]
    (...)
    [/html]



    So, i can see every detail I received from email, besides google not recognizing it.
    TY!

    PS: [ = <

    ReplyDelete
  32. Scott,
    I really love your script. That makes my travels so easy now as I had most of my reservations bundled but some were not recognized before! Now I just add them manually!
    Thanks for your great work.
    Hope you will find a way to integrate also the train reservations soon!

    Regards from Germany, Florian

    ReplyDelete
  33. Very useful post. Thanks,
    Couple observation for me:
    1/ Seem to work only on gmail account, gapps account using the exact script did not produce the trip card.
    2/ Even if I forward the same email which created the trip card in my gmail account to the gapps email account, the trip card won't get produced there!

    ReplyDelete
  34. trying to get a hotel confirmation going, but receiving this message: Missing : after property ID. (line 4, file "Code")

    what I have so far:

    function manuallyCreateTrips() {
    var htmlBody = HtmlService.createHtmlOutputFromFile('Hotel').getContent();

    MailApp.sendEmail({
    to: Session.getActiveUser().getEmail(),
    subject:'Hotel Confirmation - Brooklyn, New York' + 2016-11-04(),
    htmlBody: htmlBody,
    });
    }

    ReplyDelete
  35. *correction this is the message : TypeError: 4.0 is not a function, it is number. (line 4, file "Code")

    ReplyDelete
  36. Hi Scott,

    I've followed both your advice here and the correct JSON configuration on the Google documentation, but I just cannot get the system to show two passengers on the card. Is there a trick to multiple passengers?

    ReplyDelete
    Replies
    1. Make sure you have it formatted exactly like they have it here: https://developers.google.com/gmail/markup/reference/flight-reservation

      Otherwise I am not sure

      Delete
  37. Here is a question for you. I already have a trip created from a Hotel Reservation from a while ago (the trip is set to start on 11/4 and end on 11/5). I booked another hotel for the next week 11/9 to 11/10 in a different city, and that hotel went in to the 11/4 trip bundle. So I removed it, and I used your trick to jump start a new trip, but that goes into the 11/4 trip too. So then I figured the dates were too close, so I did a trip with your script for 11/25 and that still went in to the 11/4 trip bundle.

    The 11/4 trip is to Atlantic City, NJ and the 11/9 trip is to Philadelphia, PA. Now I suppose they are fairly close to each other, but with no reservations from 11/5 to 11/8 why would the Philly trip bundle in the AC trip?

    I even tried to create a trip with your script to a completely different country and it STILL went in to the 11/4 bundle.

    Thoughts?

    ReplyDelete
    Replies
    1. That is very very strange and I do not know why that would be happening. Definitely use the feedback in the program to report this to the team

      Delete
    2. I have the same problem a lot, and report it every time. I had a hotel reservation creating a trip correctly, but the flights were not added. So I started by adding one of the flights manually. It then included trips back to March, into the same trip. I've tried to tell them to PLEASE not include historic trips when checking for trip information.

      I think the trip feature would work a lot better if:
      * Only the inbox was checked (i.e. not archived items)
      * Historic trips were ignored

      I've told them this about 10 times (yes I do travel a lot). So frustrated that they cannot make this simple fix to the robot.

      br
      John Erik

      Delete
  38. hi,
    I had a bundle for one trip which created by mails I got week ago.
    by mistake I deleted it. :-(
    I tried to generate this trip again with this script but it doesnt create it.

    Do you know why?
    if I delete a trip it cannot be recovered?

    Thanks m.r.

    ReplyDelete
    Replies
    1. If you still have the original emails (maybe in trash) forward them to another account, delete them, and then forward them back

      Delete
  39. Hello and thank you for your blog !

    Scripts works gerat to sending emails.

    Unfortunately my trips are only by trains. And as I send only Car confirmation and Hotel Confirmation, no bundle appears even after more than 1 hr.

    Have you made any progress in a TRAIN script ? Do you have any advice ?

    ReplyDelete
    Replies
    1. Nope still can't make trips wth train tickets

      Delete
    2. Thank anyway ! I manage to create a trip onlu with your originals html. And then I fill it with my reservations and delete the "Oslo" email. As far as I get a way to create a trip your tip is great.

      Delete
  40. Scott, just found this and it looks awesome.... and easy to use.... one thing though.... the wife and I do a lot of cruising and would it be possible to create another script for cruisers.

    ReplyDelete
    Replies
    1. Currently there is no email markup for Trains or Cruises

      Delete
    2. Like a user above I simply modeled it as a "hotel". Not the best in the world, but I'll take what I can get!

      Delete
  41. Thanks for this Scott - very cool. It did work for me, sort of. The trip didn't get recreated until I used the script to create a card for a reservation that hadn't been picked up automatically in the original Trip bundle. It then picked up my flights on its own but I had to add all the other reservations manually. Strangely they then vanished ... I've added them back and hopefully they'll stay. Wish they'd get this to work properly :(

    ReplyDelete
  42. Thanks Scott. Created and ran the script a few hours ago. Got the email - the Trip is yet to be seen. Sigh.

    ReplyDelete
    Replies
    1. It can take up to a day or two for the trip to create

      Delete
  43. Excellent!!!! Thanks a lot. With the Google trips this became awsome

    ReplyDelete
  44. Is it possible to rename de trip?

    ReplyDelete
    Replies
    1. If you install the app Google Trips on android, you can rename the trips there and it will reflect in Inbox

      Delete
  45. Created 2 bus reservation cards and 1 train reservation card. But they were never added to the trip card. After I added them manualy, they are not appeared in the trip bundle. Hate that this thing is still not working.

    ReplyDelete
    Replies
    1. Bus and Train tickets, as well as cruises are not currently able to be parsed into a trip

      Delete
  46. Hi,
    Maybe what I am going to say sounds absurd, but...

    you can create Trips by simply picking up an old email (I did it with the flight resevervation of an old trip), and "forward" to yourself. Then, edit the text, change the dates and flight numbers and airports....and send it. DONE.

    It is easier than using coding and all that stuff.

    Best regards,

    ReplyDelete
    Replies
    1. Yes this is true and this is what I first suggest to people in the Inbox help forum. But it only works if you still have the emails.

      Delete
  47. Hi Scott,
    Just tried this and it worked great. Thanks so much for this! Such a shame that Google have limited it to hotels, car rental, restaurants and hotels.

    I wanted to add my airport parking In London to my trip to Bucharest. As a work around for Google not having this schema in place I simply used the car rental template. It did not get added to the trip automatically so I moved the email into the Bucharest trip in Google Inbox and now I can see it in the app. The annoying thing, which is entirely Google's fault again, is that now it thinks my trip is to both London and Bucharest. It doesn't make the Trips app any less useable, but it is annoying from an OCD point of view! But at least I have all the trip info in one place.

    Once Google implement airport parking properly I imagine this would no longer be a problem.

    Great Work!

    ReplyDelete
  48. Tino,

    I hear you loud and clear about the OCD thing. That's why I use the Google Trips app to rename my trips.

    Two weeks ago I was taking a business trip first to Minneapolis, MN and then to Columbus, OH. Google named the trip, "Trip to Columbus & Minneapolis". No way did that sit well with me so I renamed the trip to "Trip to Minneapolis & Columbus" with the Google Trips app.

    ReplyDelete
  49. No matter what details I put in, the previous come up saying Oslo for the auto rental and San Francisco for the Hotel (there's not a mention of either in the code though) so the trip is created for San Fran & not my actual destination, any idea how i can work around this?!

    Thanks

    ReplyDelete
    Replies
    1. Oslo is in the original scripts that I shared - so you may have missed something.

      Delete
  50. I used your video, and thought I followed it correctly but it never made a Trip for me in InBox.... can you take a look and tell me where I went wrong so I can understand the process. I purposely left the word script out of this message because it would not let me post with it in it, but they are in my code.

    Code
    function manuallyCreateTrips() {
    var htmlBody = HtmlService.createHtmlOutputFromFile('Hotel').getContent();

    MailApp.sendEmail({
    to: Session.getActiveUser().getEmail(),
    subject: 'High Seas Rally ' + new Date(),
    htmlBody: htmlBody,
    });
    }

    Hotel

    {
    "@context": "http://schema.org",
    "@type": "LodgingReservation",
    "reservationNumber": "32JCW737",
    "reservationStatus": "http://schema.org/Confirmed",
    "underName": {
    "@type": "Person",
    "name": "Thomas Krpata"
    },
    "reservationFor": {
    "@type": "LodgingBusiness",
    "name": "Embassy Suites by Hilton",
    "address": {
    "@type": "PostalAddress",
    "streetAddress": "513 S Florida Ave",
    "addressLocality": "Tampa",
    "addressRegion": "FL",
    "postalCode": "33602",
    "addressCountry": "US"
    },
    "telephone": "813-769-8300"
    },
    "checkinDate": "2017-12-01T16:00:00-08:00",
    "checkoutDate": "2017-12-04T11:00:00-08:00"
    }

    ReplyDelete
    Replies
    1. Looks good. It can take a few hours for the trip to be made

      Delete
  51. I've just tried (it didn't show up in a trip yet), but using the markup from https://schema.org/TrainReservation, Inbox was able to parse the info and it even shows visiting the gare in Maps!

    ReplyDelete
    Replies
    1. ANd it wont - train trips can be parsed into nice easy to display cards but they will not (at this time) become a Trip in Inbox.

      Delete
    2. But can it be part of a larger trip?

      Delete
    3. No trains cannot e part of a trip. You can add it to an existing trip but it will only be for keeping all of the emails together.

      Delete
  52. By the way, maybe you can settle this for me: I had a trip but the flight changed, when I deleted the original confirmation email the trip vanished (fortunately, all other mail that I'd bundled with it got back into inbox). That was a couple of weeks ago. The confirmation email for the new date didn't spawn a trip; I've tried copying the email and sending it to me again; I've tried to create a trip in the Trips app; and I've tried sending an email using Schema.org's metadata. Will this trip ever show up again? Or will I be forced to create a label like a barbaric?

    ReplyDelete
  53. Anyone figure out how to make this work with a gapps account?

    ReplyDelete
  54. Worked great for a train trip but it never showed up in the trips bundle in Google inbox.

    ReplyDelete
    Replies
    1. Correct - its only making Train cards, but not trips, same with Buses at this point. I am ooking into it tho

      Delete
  55. hey Scott is there a way to do this with product / receipt emails?

    ReplyDelete
    Replies
    1. Bundling into a trip? I am not sure what you mean

      Delete
  56. Thanks for this. Exactly what I was looking for.

    ReplyDelete
  57. All these maybe fun or adventures for some people to dig. But why not just use Tripit free version? It does all the work.

    ReplyDelete
  58. How does one enter the appropriate info for multi-leg flights? The script seems to only handle one leg. I have tried copying parts and all of the info for one flight and duplicating it, but I'm not seeing that work, no matter what I try. You would think that, with so many hub-dependent airliens these days, that most flights would be multi-leg and that this issue would have come up for others?

    ReplyDelete
    Replies
    1. See here for the markup language and scroll down to the multiple leg flight section
      https://developers.google.com/gmail/markup/reference/flight-reservation

      Delete
  59. Hi Scott - thank you for providing all this great detail on Google trips. Do you know if it is possible to add "Notes" to the app using a script.

    ReplyDelete
  60. Followed your instructions the the letter. Did not get the initial email.

    Checked for spelling issues in the .gs and it was fine. Copied and pasted your original flight.html file directly and tried to run it as a test. No email.

    First time I ran the script - i did get the permissions and gave the script permissions.

    Any ideas?

    ReplyDelete
    Replies
    1. You still not getting the email? That is very odd. Check other bundles like spam or trash

      Delete